Re: [PATCH] kmemleak: Only use GFP_KERNEL|GFP_ATOMIC for theinternal allocations

From: Pekka Enberg
Date: Wed Jun 17 2009 - 09:30:59 EST


On Wed, 2009-06-17 at 14:23 +0100, Catalin Marinas wrote:
> On Wed, 2009-06-17 at 16:01 +0300, Pekka Enberg wrote:
> > On Wed, Jun 17, 2009 at 3:52 PM, Catalin Marinas<catalin.marinas@xxxxxxx> wrote:
> > > Kmemleak allocates memory for pointer tracking and it tries to avoid
> > > using GFP_ATOMIC if the caller doesn't require it. However other gfp
> > > flags may be passed by the caller which aren't required by kmemleak.
> > > This patch filters the gfp flags so that only GFP_KERNEL | GFP_ATOMIC
> > > are used.
> > >
> > > Signed-off-by: Catalin Marinas <catalin.marinas@xxxxxxx>
> >
> > Is this really safe? What if we're in a middle of a filesystem
> > operation that uses GFP_NOFAIL and all of a sudden kmemleak allocation
> > fails and causes a panic?
>
> A kmemleak_panic() call only disables the kmemleak but doesn't stop the
> kernel. The __GFP_NOFAIL allocation had already happened and the pointer
> returned to the caller.

Ah, ok. I was confused by the name of kmemleak_panic() (which could use
renaming methinks).

Acked-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>

Pekka

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/