Re: [PATCH 1/2] kmemleak: Delete an error message for a failed memory allocation in two functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 14, 2017 at 04:02:21PM +0300, Dan Carpenter wrote:
> On Mon, Aug 14, 2017 at 12:14:32PM +0100, Catalin Marinas wrote:
> > On Mon, Aug 14, 2017 at 11:35:02AM +0200, SF Markus Elfring wrote:
> > > From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> > > Date: Mon, 14 Aug 2017 10:50:22 +0200
> > > 
> > > Omit an extra message for a memory allocation failure in these functions.
> > > 
> > > This issue was detected by using the Coccinelle software.
> > > 
> > > Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> > > ---
> > >  mm/kmemleak.c | 5 +----
> > >  1 file changed, 1 insertion(+), 4 deletions(-)
> > > 
> > > diff --git a/mm/kmemleak.c b/mm/kmemleak.c
> > > index 7780cd83a495..c6c798d90b2e 100644
> > > --- a/mm/kmemleak.c
> > > +++ b/mm/kmemleak.c
> > > @@ -555,7 +555,6 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size,
> > >  
> > >  	object = kmem_cache_alloc(object_cache, gfp_kmemleak_mask(gfp));
> > >  	if (!object) {
> > > -		pr_warn("Cannot allocate a kmemleak_object structure\n");
> > >  		kmemleak_disable();
> > 
> > I don't really get what this patch is trying to achieve. Given that
> > kmemleak will be disabled after this, I'd rather know why it happened.
> 
> kmem_cache_alloc() will generate a stack trace and a bunch of more
> useful information if it fails.  The allocation isn't likely to fail,
> but if it does you will know.  The extra message is just wasting RAM.

Currently kmemleak uses __GFP_NOWARN for its own metadata allocation, so
we wouldn't see the sl*b warnings. I don't fully remember why I went for
this gfp flag, probably not to interfere with other messages printed by
the allocator (kmemleak_alloc is called from within sl*b).

I'm fine to drop __GFP_NOWARN and remove those extra messages.

-- 
Catalin
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux