aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mm.h
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2007-05-06 14:49:41 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 12:12:54 -0700
commitb49af68ff9fc5d6e0d96704a1843968b91cc73c6 (patch)
treeeb5e6d9425a9069cdfc45b09a1d0f61f1419d2c2 /include/linux/mm.h
parentmm: optimize compound_head() by avoiding a shared page flag (diff)
downloadlinux-dev-b49af68ff9fc5d6e0d96704a1843968b91cc73c6.tar.xz
linux-dev-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 'include/linux/mm.h')
-rw-r--r--include/linux/mm.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 695b90437bbc..4670ebd1f622 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -286,6 +286,12 @@ static inline void get_page(struct page *page)
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)