]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
slab: Remove references to folios from virt_to_slab()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 13 Nov 2025 00:09:30 +0000 (00:09 +0000)
committerVlastimil Babka <vbabka@suse.cz>
Thu, 13 Nov 2025 19:23:58 +0000 (20:23 +0100)
Use page_slab() instead of virt_to_folio() which will work
perfectly when struct slab is separated from struct folio.

This was the last user of folio_slab(), so delete it.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Link: https://patch.msgid.link/20251113000932.1589073-17-willy@infradead.org
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
mm/slab.h

index 31ccf0f6d3a163626ed68eabf9abb02a3de00ff1..6e3e80c900439d91134158b4f72202017479681b 100644 (file)
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -117,19 +117,6 @@ static_assert(sizeof(struct slab) <= sizeof(struct page));
 static_assert(IS_ALIGNED(offsetof(struct slab, freelist), sizeof(freelist_aba_t)));
 #endif
 
-/**
- * folio_slab - Converts from folio to slab.
- * @folio: The folio.
- *
- * Currently struct slab is a different representation of a folio where
- * folio_test_slab() is true.
- *
- * Return: The slab which contains this folio.
- */
-#define folio_slab(folio)      (_Generic((folio),                      \
-       const struct folio *:   (const struct slab *)(folio),           \
-       struct folio *:         (struct slab *)(folio)))
-
 /**
  * slab_folio - The folio allocated for a slab
  * @s: The slab.
@@ -192,12 +179,7 @@ static inline pg_data_t *slab_pgdat(const struct slab *slab)
 
 static inline struct slab *virt_to_slab(const void *addr)
 {
-       struct folio *folio = virt_to_folio(addr);
-
-       if (!folio_test_slab(folio))
-               return NULL;
-
-       return folio_slab(folio);
+       return page_slab(virt_to_page(addr));
 }
 
 static inline int slab_order(const struct slab *slab)