diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2021-10-04 14:45:53 +0100 |
---|---|---|
committer | Vlastimil Babka <vbabka@suse.cz> | 2022-01-06 12:25:41 +0100 |
commit | 82c1775dc11a954f3d8c4cb875dff24ea97bc82b (patch) | |
tree | 021257e762449b5836bcb7c1925a4b3ca832892d /mm | |
parent | b918653b4f32881afb383b7b5853a7edfe0937a6 (diff) | |
download | linux-rpi-82c1775dc11a954f3d8c4cb875dff24ea97bc82b.tar.gz linux-rpi-82c1775dc11a954f3d8c4cb875dff24ea97bc82b.tar.bz2 linux-rpi-82c1775dc11a954f3d8c4cb875dff24ea97bc82b.zip |
mm: Convert virt_to_cache() to use struct slab
This function is entirely self-contained, so can be converted from page
to slab.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Roman Gushchin <guro@fb.com>
Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/slab.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mm/slab.h b/mm/slab.h index dd3f72fddff6..1408ada9ff72 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -574,13 +574,13 @@ static inline void memcg_slab_free_hook(struct kmem_cache *s, static inline struct kmem_cache *virt_to_cache(const void *obj) { - struct page *page; + struct slab *slab; - page = virt_to_head_page(obj); - if (WARN_ONCE(!PageSlab(page), "%s: Object is not a Slab page!\n", + slab = virt_to_slab(obj); + if (WARN_ONCE(!slab, "%s: Object is not a Slab page!\n", __func__)) return NULL; - return page->slab_cache; + return slab->slab_cache; } static __always_inline void account_slab(struct slab *slab, int order, |