From: Paul Mundt <lethal@linux-sh.org>
To: Matt Mackall <mpm@selenic.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>,
David Howells <dhowells@redhat.com>,
Christoph Lameter <clameter@sgi.com>,
linux-mm@kvack.org
Subject: Re: [PATCH] nommu: Push kobjsize() slab-specific logic down to ksize().
Date: Wed, 21 May 2008 11:43:41 +0900 [thread overview]
Message-ID: <20080521024341.GA26159@linux-sh.org> (raw)
In-Reply-To: <1211300958.18026.181.camel@calx>
On Tue, May 20, 2008 at 11:29:18AM -0500, Matt Mackall wrote:
> On Tue, 2008-05-20 at 18:59 +0900, Paul Mundt wrote:
> > Moving the existing logic in to SLAB's ksize() and simply wrapping in to
> > ksize() directly seems to do the right thing in all cases, and allows me
> > to boot with any of the slab allocators enabled, rather than simply SLAB
> > by itself.
> >
> > I've done the same !PageSlab() test in SLAB as SLUB does in its ksize(),
> > which also seems to produce the correct results. Hopefully someone more
> > familiar with the history of kobjsize()/ksize() interaction can scream if
> > this is the wrong thing to do. :-)
>
> My investigation of this the last time around lead me to the conclusion
> that the nommu code here was broken as it can call ksize on objects that
> were statically allocated (IIRC, the initial task struct is one such
> example).
>
> It also calls ksize on objects that are kmem_cache_alloced, which is
> also a no-no. Unfortunately, it's a no-no that just happens to work in
> SLAB/SLUB by virtue of implementing kmalloc on top of kmem_cache_alloc.
>
> With SLOB, the object size for kmem_cache_alloced objects is only
> available statically. Further, we can only statically distinguish
> between a kmalloc'ed and kmem_cache_alloc'ed object. So when you pass a
> kmem_cache_alloc'ed object, we'll end up reading random data outside the
> object to find its 'size'. So this might 'work' for SLOB in the sense of
> not crashing, but it won't be correct.
>
SLOB also is unique in that it doesn't end up setting __GFP_COMP on
higher-order pass through allocations through the kmem_cache_alloc path.
So we could at least check to see whether the object is a compound page
or not before deferring to ksize() -- otherwise just default to
PAGE_SIZE. Though this doesn't help for statics that are out of scope of
both kmalloc and kmem_cache_alloc, or things like the blackfin DMA area
past the end of memory. Hmm.
--
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>
next prev parent reply other threads:[~2008-05-21 2:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-20 9:59 [PATCH] nommu: Push kobjsize() slab-specific logic down to ksize() Paul Mundt
2008-05-20 15:18 ` David Howells
2008-05-20 16:52 ` Christoph Lameter
2008-05-20 18:23 ` Matt Mackall
2008-05-20 18:51 ` Christoph Lameter
2008-05-20 19:00 ` Matt Mackall
2008-05-20 19:08 ` Christoph Lameter
2008-05-20 19:14 ` Matt Mackall
2008-05-20 19:16 ` Christoph Lameter
2008-05-20 21:22 ` Matt Mackall
2008-05-21 1:19 ` Paul Mundt
2008-05-21 1:52 ` Christoph Lameter
2008-05-22 4:23 ` Pekka Enberg
2008-05-20 16:29 ` Matt Mackall
2008-05-21 2:43 ` Paul Mundt [this message]
2008-05-21 14:58 ` Pekka Enberg
2008-05-21 15:06 ` Matt Mackall
2008-05-21 17:13 ` Pekka J Enberg
2008-05-21 17:27 ` Christoph Lameter
2008-05-21 19:08 ` Pekka Enberg
2008-05-21 23:43 ` Paul Mundt
2008-05-22 0:01 ` 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=20080521024341.GA26159@linux-sh.org \
--to=lethal@linux-sh.org \
--cc=clameter@sgi.com \
--cc=dhowells@redhat.com \
--cc=linux-mm@kvack.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).