linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Christoph Hellwig <hch@lst.de>
Cc: dgc@sgi.com, linux-mm@kvack.org
Subject: Re: [PATCH] slab: cleanup kmem_getpages
Date: Tue, 18 Apr 2006 16:38:26 -0700	[thread overview]
Message-ID: <20060418163826.78af10a0.akpm@osdl.org> (raw)
In-Reply-To: <20060418232428.GA13570@lst.de>

Christoph Hellwig <hch@lst.de> wrote:
>
> > > +	page = alloc_pages_node(nodeid, flags, cachep->gfporder);
> > >  	if (!page)
> > >  		return NULL;
> > > -	addr = page_address(page);
> > .....
> > > +	while (nr_pages--) {
> > >  		__SetPageSlab(page);
> > >  		page++;
> > >  	}
> > > -	return addr;
> > > +	return page_address(page);
> > 
> > I think that's a bug - you return the address of the page after the
> > allocation, not the first page of the allocation.
> 
> You're right.  I wonder why this didn't show up in my testing.  Looks
> like slab will never allocate any high-order pages if your page size
> is big enough..
> 
> Andrew, please drop this for now.  I'll redo it without that bit once
> I'll get some time.

I already fixed it - it was giving me instantaneous oopses.

--- devel/mm/slab.c~slab-cleanup-kmem_getpages-fix	2006-04-15 01:00:53.000000000 -0700
+++ devel-akpm/mm/slab.c	2006-04-15 01:01:49.000000000 -0700
@@ -1492,6 +1492,7 @@ static void *kmem_getpages(struct kmem_c
 {
 	struct page *page;
 	int nr_pages;
+	int i;
 
 #ifndef CONFIG_MMU
 	/*
@@ -1510,10 +1511,8 @@ static void *kmem_getpages(struct kmem_c
 	if (cachep->flags & SLAB_RECLAIM_ACCOUNT)
 		atomic_add(nr_pages, &slab_reclaim_pages);
 	add_page_state(nr_slab, nr_pages);
-	while (nr_pages--) {
-		__SetPageSlab(page);
-		page++;
-	}
+	for (i = 0; i < nr_pages; i++)
+		__SetPageSlab(page + i);
 	return page_address(page);
 }
 
_

--
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>

      reply	other threads:[~2006-04-18 23:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-14 18:36 [PATCH] slab: cleanup kmem_getpages Christoph Hellwig
2006-04-18 23:20 ` David Chinner
2006-04-18 23:24   ` Christoph Hellwig
2006-04-18 23:38     ` Andrew Morton [this message]

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=20060418163826.78af10a0.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=dgc@sgi.com \
    --cc=hch@lst.de \
    --cc=linux-mm@kvack.org \
    /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).