summaryrefslogtreecommitdiffstats
path: root/mm/slub.c
diff options
context:
space:
mode:
authorChristoph Lameter2007-05-06 23:49:41 +0200
committerLinus Torvalds2007-05-07 21:12:54 +0200
commitb49af68ff9fc5d6e0d96704a1843968b91cc73c6 (patch)
treeeb5e6d9425a9069cdfc45b09a1d0f61f1419d2c2 /mm/slub.c
parentmm: optimize compound_head() by avoiding a shared page flag (diff)
downloadkernel-qcow2-linux-b49af68ff9fc5d6e0d96704a1843968b91cc73c6.tar.gz
kernel-qcow2-linux-b49af68ff9fc5d6e0d96704a1843968b91cc73c6.tar.xz
kernel-qcow2-linux-b49af68ff9fc5d6e0d96704a1843968b91cc73c6.zip
Add virt_to_head_page and consolidate code in slab and slub
Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 8fa1c6e937f5..347c11e80d8e 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1323,9 +1323,7 @@ void kmem_cache_free(struct kmem_cache *s, void *x)
{
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, TRACK_FREE);
@@ -1336,7 +1334,7 @@ EXPORT_SYMBOL(kmem_cache_free);
/* 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;
@@ -2076,7 +2074,7 @@ void kfree(const void *x)
if (!x)
return;
- page = compound_head(virt_to_page(x));
+ page = virt_to_head_page(x);
s = page->slab;
@@ -2112,7 +2110,7 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags)
return NULL;
}
- page = compound_head(virt_to_page(p));
+ page = virt_to_head_page(p);
new_cache = get_slab(new_size, flags);