slub and slob both use struct page here; convert them to struct slab. Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> --- mm/slab.h | 6 +++--- mm/slob.c | 8 ++++---- mm/slub.c | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/mm/slab.h b/mm/slab.h index 3c691ef6b492..ac89b656de67 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -14,7 +14,7 @@ static inline bool slab_test_cache(const struct slab *slab) return test_bit(PG_slab, &slab->flags); } -static inline bool slab_test_multi_page(const struct slab *slab) +static inline bool slab_test_multipage(const struct slab *slab) { return test_bit(PG_head, &slab->flags); } @@ -67,7 +67,7 @@ static inline struct slab *virt_to_slab(const void *addr) static inline int slab_order(const struct slab *slab) { - if (!slab_test_multi_page(slab)) + if (!slab_test_multipage(slab)) return 0; return ((struct page *)slab)[1].compound_order; } @@ -483,7 +483,7 @@ static inline struct kmem_cache *virt_to_cache(const void *obj) struct slab *slab; slab = virt_to_slab(obj); - if (WARN_ONCE(!SlabAllocation(slab), "%s: Object is not a Slab page!\n", + if (WARN_ONCE(!slab_test_cache(slab), "%s: Object is not a Slab page!\n", __func__)) return NULL; return slab->slab_cache; diff --git a/mm/slob.c b/mm/slob.c index 74d3f6e60666..90996e8f7337 100644 --- a/mm/slob.c +++ b/mm/slob.c @@ -570,7 +570,7 @@ EXPORT_SYMBOL(kfree); /* can't use ksize for kmem_cache_alloc memory, only kmalloc */ size_t __ksize(const void *block) { - struct page *sp; + struct slab *sp; int align; unsigned int *m; @@ -578,9 +578,9 @@ size_t __ksize(const void *block) if (unlikely(block == ZERO_SIZE_PTR)) return 0; - sp = virt_to_page(block); - if (unlikely(!PageSlab(sp))) - return page_size(sp); + sp = virt_to_slab(block); + if (unlikely(!slab_test_cache(sp))) + return slab_size(sp); align = max_t(size_t, ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); m = (unsigned int *)(block - align); diff --git a/mm/slub.c b/mm/slub.c index 7e429a31b326..2780342395dc 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4509,19 +4509,19 @@ void __check_heap_object(const void *ptr, unsigned long n, struct page *page, size_t __ksize(const void *object) { - struct page *page; + struct slab *slab; if (unlikely(object == ZERO_SIZE_PTR)) return 0; - page = virt_to_head_page(object); + slab = virt_to_slab(object); - if (unlikely(!PageSlab(page))) { - WARN_ON(!PageCompound(page)); - return page_size(page); + if (unlikely(!slab_test_cache(slab))) { + WARN_ON(!slab_test_multipage(slab)); + return slab_size(slab); } - return slab_ksize(page->slab_cache); + return slab_ksize(slab->slab_cache); } EXPORT_SYMBOL(__ksize); -- 2.32.0