From: Christoph Lameter <clameter@sgi.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Hugh Dickins <hugh@veritas.com>, Nick Piggin <npiggin@suse.de>,
dgc@sgi.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] Make page->private usable in compound pages V1
Date: Fri, 6 Apr 2007 12:46:39 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0704061245210.23939@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20070405164300.a5d24329.akpm@linux-foundation.org>
On Thu, 5 Apr 2007, Andrew Morton wrote:
> A new virt_to_head_page() is needed.
Add virt_to_head_page and consolidate code in slab and slub.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.21-rc5-mm4/include/linux/mm.h
===================================================================
--- linux-2.6.21-rc5-mm4.orig/include/linux/mm.h 2007-04-06 19:35:51.000000000 +0000
+++ linux-2.6.21-rc5-mm4/include/linux/mm.h 2007-04-06 19:42:53.000000000 +0000
@@ -316,6 +316,12 @@
atomic_inc(&page->_count);
}
+static inline struct page *virt_to_head_page(const void *x)
+{
+ struct page *page = virt_to_page(x);
+ return compound_head(page);
+}
+
/*
* Setup the page count before being freed into the page allocator for
* the first time (boot or memory hotplug)
Index: linux-2.6.21-rc5-mm4/mm/slab.c
===================================================================
--- linux-2.6.21-rc5-mm4.orig/mm/slab.c 2007-04-06 19:38:58.000000000 +0000
+++ linux-2.6.21-rc5-mm4/mm/slab.c 2007-04-06 19:41:57.000000000 +0000
@@ -614,20 +614,19 @@
static inline struct slab *page_get_slab(struct page *page)
{
- page = compound_head(page);
BUG_ON(!PageSlab(page));
return (struct slab *)page->lru.prev;
}
static inline struct kmem_cache *virt_to_cache(const void *obj)
{
- struct page *page = virt_to_page(obj);
+ struct page *page = virt_to_head_page(obj);
return page_get_cache(page);
}
static inline struct slab *virt_to_slab(const void *obj)
{
- struct page *page = virt_to_page(obj);
+ struct page *page = virt_to_head_page(obj);
return page_get_slab(page);
}
@@ -2884,7 +2883,7 @@
objp -= obj_offset(cachep);
kfree_debugcheck(objp);
- page = virt_to_page(objp);
+ page = virt_to_head_page(objp);
slabp = page_get_slab(page);
@@ -3108,7 +3107,7 @@
struct slab *slabp;
unsigned objnr;
- slabp = page_get_slab(virt_to_page(objp));
+ slabp = page_get_slab(virt_to_head_page(objp));
objnr = (unsigned)(objp - slabp->s_mem) / cachep->buffer_size;
slab_bufctl(slabp)[objnr] = BUFCTL_ACTIVE;
}
Index: linux-2.6.21-rc5-mm4/mm/slub.c
===================================================================
--- linux-2.6.21-rc5-mm4.orig/mm/slub.c 2007-04-06 19:37:49.000000000 +0000
+++ linux-2.6.21-rc5-mm4/mm/slub.c 2007-04-06 19:38:56.000000000 +0000
@@ -1297,9 +1297,7 @@
{
struct page * page;
- page = virt_to_page(x);
-
- page = compound_head(page);
+ page = virt_to_head_page(x);
if (unlikely(PageError(page) && (s->flags & SLAB_STORE_USER)))
set_tracking(s, x, 1);
@@ -1310,7 +1308,7 @@
/* Figure out on which slab object the object resides */
static struct page *get_object_page(const void *x)
{
- struct page *page = compound_head(virt_to_page(x));
+ struct page *page = virt_to_head_page(x);
if (!PageSlab(page))
return NULL;
@@ -1952,7 +1950,7 @@
if (!x)
return;
- page = compound_head(virt_to_page(x));
+ page = virt_to_head_page(x);
s = page->slab;
@@ -1988,7 +1986,7 @@
return NULL;
}
- page = compound_head(virt_to_page(p));
+ page = virt_to_head_page(p);
new_cache = get_slab(new_size, flags);
prev parent reply other threads:[~2007-04-06 19:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-05 22:36 Christoph Lameter
2007-04-05 22:36 ` [PATCH 2/2] Optimize compound_head() by avoiding a shared page flag Christoph Lameter
2007-04-07 5:23 ` Andrew Morton
2007-04-07 22:16 ` Christoph Lameter
2007-04-07 22:51 ` Andrew Morton
2007-04-08 0:21 ` Christoph Lameter
2007-04-08 1:25 ` Andrew Morton
2007-04-08 1:32 ` Christoph Lameter
2007-04-08 1:48 ` Andrew Morton
2007-04-09 17:22 ` Christoph Lameter
2007-04-09 18:09 ` Christoph Lameter
2007-04-09 18:45 ` Andrew Morton
2007-04-09 18:49 ` Christoph Lameter
2007-04-09 22:05 ` Christoph Lameter
2007-04-05 23:43 ` [PATCH 1/2] Make page->private usable in compound pages V1 Andrew Morton
2007-04-06 17:01 ` Christoph Lameter
2007-04-06 20:04 ` Andrew Morton
2007-04-06 20:28 ` Christoph Lameter
2007-04-06 19:46 ` Christoph Lameter [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=Pine.LNX.4.64.0704061245210.23939@schroedinger.engr.sgi.com \
--to=clameter@sgi.com \
--cc=akpm@linux-foundation.org \
--cc=dgc@sgi.com \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@suse.de \
/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®