LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Pekka Enberg" <penberg@cs.helsinki.fi>
Cc: mpm@selenic.com, "Christoph Lameter" <clameter@sgi.com>,
	"ast@domdv.de" <ast@domdv.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] slab: deal with NULL pointers passed to kmem_cache_free
Date: Mon, 19 Mar 2007 14:41:00 -0700	[thread overview]
Message-ID: <20070319144100.8a87f288.akpm@linux-foundation.org> (raw)
In-Reply-To: <az5Ytbv5.1174339536.7416370.penberg@cs.helsinki.fi>

On Mon, 19 Mar 2007 23:25:36 +0200 (EET)
"Pekka Enberg" <penberg@cs.helsinki.fi> wrote:

> 
> On 3/19/2007, "Andrew Morton" <akpm@linux-foundation.org> wrote:
> > Would prefer to do:
> > 
> > static inline void kmem_cache_free_if_not_null(struct kmem_cache *cachep,
> > 						void *objp)
> > {
> > 	if (objp)
> > 		kmem_cache_free(cachep, objp);
> > }
> > 
> > so that we don't add extra overhead to all the thousands of existing,
> > well-behaved callsites.
> 
> That bloats kernel text all the same

But only for those callsites which choose to use it!  We avoid adding a
test-and-branch to those thousands of callsite which don't need it.

This is a super-hot path.

> so it's much cleaner to just make
> the callers explicitly check for NULL then. That said, I'm sorry but I
> just don't buy the "overhead" part of your argument since it's one
> branch and no extra data cache pressure especially as we're already
> doing the BUG_ON and page flag checking.

The BUG_ON (at least) should probably be moved into CONFIG_DEBUG_SLAB.

> But, since you're NAKing my patch, we need to get the mempool for from
> the original thread in to fix the oops.

We need to fix scsi rather than working around it in slab or in mempool -
it appears that it's getting its sg lists tangled up, and the problem has
been known since November (at least).

  reply	other threads:[~2007-03-19 21:42 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-19  8:27 [PATCH] slab: deal with NULL pointers passed to kmem_cache_free Pekka J Enberg
2007-03-19 11:31 ` Andrew Morton
2007-03-19 11:40   ` Pekka J Enberg
2007-03-19 17:08 ` Christoph Lameter
2007-03-19 17:31   ` Pekka J Enberg
2007-03-19 20:49   ` Matt Mackall
2007-03-19 21:10     ` Andrew Morton
2007-03-19 21:25       ` Pekka Enberg
2007-03-19 21:41         ` Andrew Morton [this message]
2007-03-19 21:49           ` Matt Mackall
2007-03-20  7:06           ` Pekka Enberg
2007-03-20 18:41             ` Christoph Lameter
2007-03-21 11:42               ` Pekka J Enberg
2007-03-20  7:14           ` Pekka Enberg
2007-03-20  7:39             ` Eric Dumazet
2007-03-20  7:47               ` Pekka J Enberg
2007-03-20  7:56                 ` Eric Dumazet
2007-03-21 10:11                 ` Jarek Poplawski
2007-03-21 12:13                   ` Pekka Enberg
2007-03-21 13:31                     ` Jarek Poplawski
2007-03-21 13:36                       ` Pekka J Enberg
2007-03-21 14:11                         ` Rafael J. Wysocki
2007-03-21 14:41                           ` Pekka Enberg
2007-03-21 16:30                             ` Andrew Morton
2007-03-21 17:54                               ` Jörn Engel
2007-03-21 18:32                               ` Pekka Enberg
2007-03-21 14:45                         ` Jarek Poplawski
2007-03-19 22:04       ` Jörn Engel
2007-03-19 21:16     ` Christoph Lameter
2007-03-19 21:44       ` Matt Mackall
2007-03-19 23:32 ` Andreas Steinmetz

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=20070319144100.8a87f288.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ast@domdv.de \
    --cc=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --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;
as well as URLs for NNTP newsgroup(s).