summaryrefslogtreecommitdiff
path: root/mm/slub.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 9d52cce7c999..8fa1c6e937f5 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1325,9 +1325,7 @@ void kmem_cache_free(struct kmem_cache *s, void *x)
page = virt_to_page(x);
- if (unlikely(PageCompound(page)))
- page = page->first_page;
-
+ page = compound_head(page);
if (unlikely(PageError(page) && (s->flags & SLAB_STORE_USER)))
set_tracking(s, x, TRACK_FREE);
@@ -1338,10 +1336,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 = virt_to_page(x);
-
- if (unlikely(PageCompound(page)))
- page = page->first_page;
+ struct page *page = compound_head(virt_to_page(x));
if (!PageSlab(page))
return NULL;
@@ -2081,10 +2076,7 @@ void kfree(const void *x)
if (!x)
return;
- page = virt_to_page(x);
-
- if (unlikely(PageCompound(page)))
- page = page->first_page;
+ page = compound_head(virt_to_page(x));
s = page->slab;
@@ -2120,10 +2112,7 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags)
return NULL;
}
- page = virt_to_page(p);
-
- if (unlikely(PageCompound(page)))
- page = page->first_page;
+ page = compound_head(virt_to_page(p));
new_cache = get_slab(new_size, flags);