linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: SF Markus Elfring <elfring@users.sourceforge.net>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/2] kmemleak: Delete an error message for a failed memory allocation in two functions
Date: Mon, 14 Aug 2017 17:45:40 +0300	[thread overview]
Message-ID: <20170814144540.q2ib32ge2ekm7irl@mwanda> (raw)
In-Reply-To: <20170814143804.d66iibto5dacvifk@armageddon.cambridge.arm.com>

On Mon, Aug 14, 2017 at 03:38:04PM +0100, Catalin Marinas wrote:
> 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@users.sourceforge.net>
> > > > 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@users.sourceforge.net>
> > > > ---
> > > >  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.
> 

Ah.  I considered that, but didn't see a NOWARN in the diff and was too
lazy to check the code.  Probably I would just leave it as-is.


regards,
dan carpenter


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-08-14 14:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-14  9:33 [PATCH 0/2] kmemleak: Adjustments for three function implementations SF Markus Elfring
2017-08-14  9:35 ` [PATCH 1/2] kmemleak: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2017-08-14 11:14   ` Catalin Marinas
2017-08-14 11:40     ` SF Markus Elfring
2017-08-14 13:02     ` Dan Carpenter
2017-08-14 14:38       ` Catalin Marinas
2017-08-14 14:45         ` Dan Carpenter [this message]
2017-08-14  9:36 ` [PATCH 2/2] kmemleak: Use seq_puts() in print_unreferenced() SF Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170814144540.q2ib32ge2ekm7irl@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=catalin.marinas@arm.com \
    --cc=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox