From: "Jesper Juhl" <jesper.juhl@gmail.com>
To: "Pekka Enberg" <penberg@cs.helsinki.fi>
Cc: linux-kernel@vger.kernel.org, "Andrew Morton" <akpm@osdl.org>,
"Christoph Lameter" <clameter@sgi.com>
Subject: Re: [PATCH] fix memory leak in mm/slab.c::alloc_kmemlist() (try #2)
Date: Mon, 20 Mar 2006 09:55:33 +0100 [thread overview]
Message-ID: <9a8748490603200055p7be38dc8lac2e78f4798e6def@mail.gmail.com> (raw)
In-Reply-To: <84144f020603191040h9b07b10w418b6cdd73f8b114@mail.gmail.com>
Hi Pekka,
On 3/19/06, Pekka Enberg <penberg@cs.helsinki.fi> wrote:
> On 3/18/06, Jesper Juhl <jesper.juhl@gmail.com> wrote:
> > Currently the only caller of alloc_kmemlist() will BUG() if alloc_kmemlist()
> > fails, but that doesn't mean we shouldn't clean up properly IMHO. Also, the
> > caller (do_tune_cpucache()) could maybe be changed in the future to do
> > something more clever than just BUG() and in that case we really shouldn't
> > be leaking memory when we return -ENOMEM.
>
> Yeah, and BUG() can be no-op for embedded.
>
> On 3/18/06, Jesper Juhl <jesper.juhl@gmail.com> wrote:
> > The patch has been compile and boot tested on x86, but since I'm not very
> > intimate with the slab code I'd appreciate it if someone would take a close
> > look on the changes before merging them.
>
> You probably didn't hit the error path on your x86 box. The patch
> looks good to me for -mm although there's few comments below.
>
> > +/*
> > + If one or more allocations fail we need to undo all allocations done up to
> > + this point.
> > + Unfortunately this means yet another loop, but since this only happens on
> > + failure and frees up memory in a memory-tight situation, it's not too bad.
> > + */
>
> The formatting of this comment looks strange.
>
> > + for_each_online_node(node) {
> > + if (count <= 0)
> > + break;
> > + if (cachep->nodelists[node]) {
>
> Would probably make sense to extract the above expression into local
> variable to reduce kernel text size.
>
> > + kfree(cachep->nodelists[node]->shared);
> > + free_alien_cache(cachep->nodelists[node]->alien);
> > + kfree(cachep->nodelists[node]);
> > + cachep->nodelists[node] = NULL;
> > + }
> > + count--;
> > + }
> > + return -ENOMEM;
>
Thank you very much for your feedback.
I'll create an updated patch with the changes you suggest. They make
perfect sense.
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
next prev parent reply other threads:[~2006-03-20 8:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-18 20:37 Jesper Juhl
2006-03-19 18:40 ` Pekka Enberg
2006-03-20 8:55 ` Jesper Juhl [this message]
2006-03-22 0:54 ` [PATCH] fix memory leak in mm/slab.c::alloc_kmemlist() (try #3) Jesper Juhl
2006-03-22 1:10 ` Christoph Lameter
2006-03-22 1:35 ` Christoph Lameter
2006-03-22 1:46 ` Andrew Morton
2006-03-22 1:52 ` Christoph Lameter
2006-03-22 2:29 ` Christoph Lameter
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=9a8748490603200055p7be38dc8lac2e78f4798e6def@mail.gmail.com \
--to=jesper.juhl@gmail.com \
--cc=akpm@osdl.org \
--cc=clameter@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@cs.helsinki.fi \
/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
all inboxes | Powered by JetHome®