[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260128135500.22121-18-kas@kernel.org>
Date: Wed, 28 Jan 2026 13:54:58 +0000
From: Kiryl Shutsemau <kas@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>,
Muchun Song <muchun.song@...ux.dev>,
David Hildenbrand <david@...hat.com>,
Matthew Wilcox <willy@...radead.org>,
Usama Arif <usamaarif642@...il.com>,
Frank van der Linden <fvdl@...gle.com>
Cc: Oscar Salvador <osalvador@...e.de>,
Mike Rapoport <rppt@...nel.org>,
Vlastimil Babka <vbabka@...e.cz>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Zi Yan <ziy@...dia.com>,
Baoquan He <bhe@...hat.com>,
Michal Hocko <mhocko@...e.com>,
Johannes Weiner <hannes@...xchg.org>,
Jonathan Corbet <corbet@....net>,
Huacai Chen <chenhuacai@...nel.org>,
WANG Xuerui <kernel@...0n.name>,
Palmer Dabbelt <palmer@...belt.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Albert Ou <aou@...s.berkeley.edu>,
Alexandre Ghiti <alex@...ti.fr>,
kernel-team@...a.com,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org,
loongarch@...ts.linux.dev,
linux-riscv@...ts.infradead.org,
Kiryl Shutsemau <kas@...nel.org>
Subject: [PATCHv5 17/17] 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().
Signed-off-by: Kiryl Shutsemau <kas@...nel.org>
---
I am not sure if this open-coded version is intentional and required for
memdesc transition. Drop the patch if it is.
---
mm/slab.h | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/mm/slab.h b/mm/slab.h
index f68c3ac8126f..970a13ac5b8e 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -137,19 +137,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;
--
2.51.2
Powered by blists - more mailing lists