Skip to content

Commit 76ade24

Browse files
Matthew Wilcox (Oracle)tehcaster
authored andcommitted
slab: Remove references to folios from virt_to_slab()
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>
1 parent bbe7117 commit 76ade24

1 file changed

Lines changed: 1 addition & 19 deletions

File tree

mm/slab.h

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,6 @@ static_assert(sizeof(struct slab) <= sizeof(struct page));
117117
static_assert(IS_ALIGNED(offsetof(struct slab, freelist), sizeof(freelist_aba_t)));
118118
#endif
119119

120-
/**
121-
* folio_slab - Converts from folio to slab.
122-
* @folio: The folio.
123-
*
124-
* Currently struct slab is a different representation of a folio where
125-
* folio_test_slab() is true.
126-
*
127-
* Return: The slab which contains this folio.
128-
*/
129-
#define folio_slab(folio) (_Generic((folio), \
130-
const struct folio *: (const struct slab *)(folio), \
131-
struct folio *: (struct slab *)(folio)))
132-
133120
/**
134121
* slab_folio - The folio allocated for a slab
135122
* @s: The slab.
@@ -192,12 +179,7 @@ static inline pg_data_t *slab_pgdat(const struct slab *slab)
192179

193180
static inline struct slab *virt_to_slab(const void *addr)
194181
{
195-
struct folio *folio = virt_to_folio(addr);
196-
197-
if (!folio_test_slab(folio))
198-
return NULL;
199-
200-
return folio_slab(folio);
182+
return page_slab(virt_to_page(addr));
201183
}
202184

203185
static inline int slab_order(const struct slab *slab)

0 commit comments

Comments
 (0)