[PATCH 09/11] PageSlab: eliminate unnecessary compound_head() calls in mm/slub

From: Johannes Weiner
Date: Tue Oct 12 2021 - 14:02:33 EST


virt_to_head_page() implies it.

Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx>
---
mm/slub.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 37a4cc1e73a7..d1bd004c8c2f 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3554,7 +3554,7 @@ int build_detached_freelist(struct kmem_cache *s, size_t size,
page = virt_to_head_page(object);
if (!s) {
/* Handle kalloc'ed objects */
- if (unlikely(!PageSlab(compound_head(page)))) {
+ if (unlikely(!PageSlab(page))) {
free_nonslab_page(page, object);
p[size] = NULL; /* mark object processed */
return size;
@@ -4516,7 +4516,7 @@ size_t __ksize(const void *object)

page = virt_to_head_page(object);

- if (unlikely(!PageSlab(compound_head(page)))) {
+ if (unlikely(!PageSlab(page))) {
WARN_ON(!PageCompound(page));
return page_size(page);
}
@@ -4536,7 +4536,7 @@ void kfree(const void *x)
return;

page = virt_to_head_page(x);
- if (unlikely(!PageSlab(compound_head(page)))) {
+ if (unlikely(!PageSlab(page))) {
free_nonslab_page(page, object);
return;
}
--
2.32.0