From: Kiryl Shutsemau Date: Fri, 27 Feb 2026 19:42:56 +0000 (+0000) Subject: mm/slab: use compound_head() in page_slab() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8231e4c040fb0ddd37d66093281d197fd5000297;p=thirdparty%2Fkernel%2Flinux.git mm/slab: use compound_head() in page_slab() page_slab() contained an open-coded implementation of compound_head(). Replace the duplicated code with a direct call to compound_head(). Link: https://lkml.kernel.org/r/20260227194302.274384-19-kas@kernel.org Signed-off-by: Kiryl Shutsemau Acked-by: David Hildenbrand (Arm) Reviewed-by: Vlastimil Babka Cc: Albert Ou Cc: Alexandre Ghiti Cc: Baoquan He Cc: Christoph Lameter Cc: David Rientjes Cc: Frank van der Linden Cc: Harry Yoo Cc: Huacai Chen Cc: Johannes Weiner Cc: Jonathan Corbet Cc: Lorenzo Stoakes Cc: Matthew Wilcox (Oracle) Cc: Michal Hocko Cc: Mike Rapoport Cc: Muchun Song Cc: Oscar Salvador Cc: Palmer Dabbelt Cc: Paul Walmsley Cc: Roman Gushchin Cc: Usama Arif Cc: WANG Xuerui Cc: Zi Yan Signed-off-by: Andrew Morton --- diff --git a/mm/slab.h b/mm/slab.h index ccbdbed18c052..77242024e7d51 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -131,19 +131,7 @@ static_assert(IS_ALIGNED(offsetof(struct slab, freelist), sizeof(struct freelist */ static inline struct slab *page_slab(const struct page *page) { - unsigned long info; - - info = READ_ONCE(page->compound_info); - if (info & 1) { - /* See compound_head() */ - if (compound_info_has_mask()) { - unsigned long p = (unsigned long)page; - page = (struct page *)(p & info); - } else { - page = (struct page *)(info - 1); - } - } - + page = compound_head(page); if (data_race(page->page_type >> 24) != PGTY_slab) page = NULL;