diff options
author | Christoph Lameter <clameter@sgi.com> | 2007-05-06 17:49:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 15:12:54 -0400 |
commit | b49af68ff9fc5d6e0d96704a1843968b91cc73c6 (patch) | |
tree | eb5e6d9425a9069cdfc45b09a1d0f61f1419d2c2 /mm/slub.c | |
parent | 6d7779538f765963ced45a3fa4bed7ba8d2c277d (diff) |
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.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -1323,9 +1323,7 @@ void kmem_cache_free(struct kmem_cache *s, void *x) | |||
1323 | { | 1323 | { |
1324 | struct page * page; | 1324 | struct page * page; |
1325 | 1325 | ||
1326 | page = virt_to_page(x); | 1326 | page = virt_to_head_page(x); |
1327 | |||
1328 | page = compound_head(page); | ||
1329 | 1327 | ||
1330 | if (unlikely(PageError(page) && (s->flags & SLAB_STORE_USER))) | 1328 | if (unlikely(PageError(page) && (s->flags & SLAB_STORE_USER))) |
1331 | set_tracking(s, x, TRACK_FREE); | 1329 | set_tracking(s, x, TRACK_FREE); |
@@ -1336,7 +1334,7 @@ EXPORT_SYMBOL(kmem_cache_free); | |||
1336 | /* Figure out on which slab object the object resides */ | 1334 | /* Figure out on which slab object the object resides */ |
1337 | static struct page *get_object_page(const void *x) | 1335 | static struct page *get_object_page(const void *x) |
1338 | { | 1336 | { |
1339 | struct page *page = compound_head(virt_to_page(x)); | 1337 | struct page *page = virt_to_head_page(x); |
1340 | 1338 | ||
1341 | if (!PageSlab(page)) | 1339 | if (!PageSlab(page)) |
1342 | return NULL; | 1340 | return NULL; |
@@ -2076,7 +2074,7 @@ void kfree(const void *x) | |||
2076 | if (!x) | 2074 | if (!x) |
2077 | return; | 2075 | return; |
2078 | 2076 | ||
2079 | page = compound_head(virt_to_page(x)); | 2077 | page = virt_to_head_page(x); |
2080 | 2078 | ||
2081 | s = page->slab; | 2079 | s = page->slab; |
2082 | 2080 | ||
@@ -2112,7 +2110,7 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags) | |||
2112 | return NULL; | 2110 | return NULL; |
2113 | } | 2111 | } |
2114 | 2112 | ||
2115 | page = compound_head(virt_to_page(p)); | 2113 | page = virt_to_head_page(p); |
2116 | 2114 | ||
2117 | new_cache = get_slab(new_size, flags); | 2115 | new_cache = get_slab(new_size, flags); |
2118 | 2116 | ||