summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKiryl Shutsemau <kas@kernel.org>2026-02-27 22:42:56 +0300
committerAndrew Morton <akpm@linux-foundation.org>2026-04-05 23:53:10 +0300
commit8231e4c040fb0ddd37d66093281d197fd5000297 (patch)
treec15f17d31efed16627554605300977d86296fd16
parentfed8676ca2b0195647046dfc955f86f53ab837f0 (diff)
downloadlinux-8231e4c040fb0ddd37d66093281d197fd5000297.tar.xz
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 <kas@kernel.org> Acked-by: David Hildenbrand (Arm) <david@kernel.org> Reviewed-by: Vlastimil Babka <vbabka@suse.cz> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Alexandre Ghiti <alex@ghiti.fr> Cc: Baoquan He <bhe@redhat.com> Cc: Christoph Lameter <cl@gentwo.org> Cc: David Rientjes <rientjes@google.com> Cc: Frank van der Linden <fvdl@google.com> Cc: Harry Yoo <harry.yoo@oracle.com> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Muchun Song <muchun.song@linux.dev> Cc: Oscar Salvador <osalvador@suse.de> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Paul Walmsley <paul.walmsley@sifive.com> Cc: Roman Gushchin <roman.gushchin@linux.dev> Cc: Usama Arif <usamaarif642@gmail.com> Cc: WANG Xuerui <kernel@xen0n.name> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--mm/slab.h14
1 files changed, 1 insertions, 13 deletions
diff --git a/mm/slab.h b/mm/slab.h
index ccbdbed18c05..77242024e7d5 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;