mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Andrew Morton <akpm@osdl.org>,
	Christoph Lameter <clameter@sgi.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix BUG_ON(!PageSlab) from fallback_alloc
Date: Thu, 4 Jan 2007 18:57:56 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0701041840360.23501@blonde.wat.veritas.com> (raw)
In-Reply-To: <84144f020701041023g5910f40ej19a80905c9ed370@mail.gmail.com>

On Thu, 4 Jan 2007, Pekka Enberg wrote:

> Hi Hugh,
> 
> [Sorry, no access to kernel tree right now, so can't send a patch.]
> 
> On 1/4/07, Hugh Dickins <hugh@veritas.com> wrote:
> > @@ -3310,7 +3310,7 @@ retry:
> >                                         */
> >                                         goto retry;
> >                         } else {
> > -                               kmem_freepages(cache, obj);
> > +                               /* cache_grow already freed obj */
> >                                 obj = NULL;
> 
> So, how about we rename the current cache_grow() to __cache_grow() and
> move the kmem_freepages() to a higher level function like this:
> 
> static int cache_grow(struct kmem_cache *cache,
>                                gfp_t flags, int nodeid)
> {
>        void *objp;
>        int ret;
> 
>        if (flags & __GFP_NO_GROW)
>                return 0;
> 
>        objp = kmem_getpages(cachep, flags, nodeid);
>        if (!objp)
>                return 0;
> 
>        ret = __cache_grow(cache, flags, nodeid, objp);
>        if (!ret)
>                kmem_freepages(cachep, objp);
> 
>        return ret;
> }
> 
> And use the non-allocating __cache_grow version() in fallback_alloc() instead?

That does indeed look more tasteful.  But there appears to be a fair
bit more refactoring one would want to do, if aiming for good taste
there: the kmem_flagcheck, the conditional local_irq_dis/enable...
I think I'll leave that to you and Christoph to fight over later!

Hugh

  parent reply	other threads:[~2007-01-04 18:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-04 17:49 Hugh Dickins
2007-01-04 18:23 ` Pekka Enberg
2007-01-04 18:43   ` Christoph Lameter
2007-01-04 20:51     ` Pekka J Enberg
2007-01-04 20:57       ` Christoph Lameter
2007-01-04 18:57   ` Hugh Dickins [this message]
2007-01-04 19:20     ` Pekka Enberg
2007-01-04 18:41 ` 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=Pine.LNX.4.64.0701041840360.23501@blonde.wat.veritas.com \
    --to=hugh@veritas.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®