[PATCH 07/11] PageSlab: eliminate unnecessary compound_head() call in mm/slab

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


kmem_freepages() is only ever called on the full slab, i.e. the
headpage. Further, after the PageSlab() check, the callsite continues
with a series of operations that are not legal on tailpages and would
trigger asserts on their own already.

Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx>
---
mm/slab.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/slab.c b/mm/slab.c
index 829f2b6d4af7..d0f725637663 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1396,7 +1396,7 @@ static void kmem_freepages(struct kmem_cache *cachep, struct page *page)
{
int order = cachep->gfporder;

- BUG_ON(!PageSlab(compound_head(page)));
+ BUG_ON(!PageSlab(page));
__ClearPageSlabPfmemalloc(page);
__ClearPageSlab(page);
page_mapcount_reset(page);
--
2.32.0