Re: [PATCH v3] kmemleaak: survive in a low-memory situation

From: Christopher Lameter
Date: Tue Mar 26 2019 - 12:00:53 EST


On Tue, 26 Mar 2019, Qian Cai wrote:

> + if (!object) {
> + /*
> + * The tracked memory was allocated successful, if the kmemleak
> + * object failed to allocate for some reasons, it ends up with
> + * the whole kmemleak disabled, so let it success at all cost.

"let it succeed at all costs"

> + */
> + gfp = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC :
> + gfp_kmemleak_mask(gfp) | __GFP_DIRECT_RECLAIM;
> + object = kmem_cache_alloc(object_cache, gfp);
> + }
> +
> if (!object) {

If the alloc must succeed then this check is no longer necessary.