From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 21 May 2008 10:27:50 -0700 (PDT) From: Christoph Lameter Subject: Re: [PATCH] nommu: Push kobjsize() slab-specific logic down to ksize(). In-Reply-To: Message-ID: References: <20080520095935.GB18633@linux-sh.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org Return-Path: To: Pekka J Enberg Cc: Paul Mundt , David Howells , Matt Mackall , linux-mm@kvack.org List-ID: On Wed, 21 May 2008, Pekka J Enberg wrote: > So I suggest we fix up kobjsize() instead. Paul, does the following > untested patch work for you? Regardless of the test : Pekka's patch is a bugfix and should go via stable. kobjsize seems to assume that page->index contains the order of a page. For a pagecache page it contains the page number in the mapping. So this should bug frequently if used on arbitrary objects. > diff --git a/mm/nommu.c b/mm/nommu.c > index ef8c62c..a573aeb 100644 > --- a/mm/nommu.c > +++ b/mm/nommu.c > @@ -115,10 +115,7 @@ unsigned int kobjsize(const void *objp) > if (PageSlab(page)) > return ksize(objp); > > - BUG_ON(page->index < 0); > - BUG_ON(page->index >= MAX_ORDER); > - > - return (PAGE_SIZE << page->index); > + return PAGE_SIZE << compound_order(page); > } > > /* > diff --git a/mm/slab.c b/mm/slab.c > -- 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: email@kvack.org