virt_to_head_page() implies it. Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx> --- mm/slab.h | 3 +-- mm/slab_common.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/slab.h b/mm/slab.h index 0446948c9c4e..4bcaa08320e6 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -410,8 +410,7 @@ static inline struct kmem_cache *virt_to_cache(const void *obj) struct page *page; page = virt_to_head_page(obj); - if (WARN_ONCE(!PageSlab(compound_head(page)), - "%s: Object is not a Slab page!\n", + if (WARN_ONCE(!PageSlab(page), "%s: Object is not a Slab page!\n", __func__)) return NULL; return page->slab_cache; diff --git a/mm/slab_common.c b/mm/slab_common.c index 5f7063797f0e..ec2bb0beed75 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -564,7 +564,7 @@ bool kmem_valid_obj(void *object) if (object < (void *)PAGE_SIZE || !virt_addr_valid(object)) return false; page = virt_to_head_page(object); - return PageSlab(compound_head(page)); + return PageSlab(page); } EXPORT_SYMBOL_GPL(kmem_valid_obj); @@ -594,7 +594,7 @@ void kmem_dump_obj(void *object) if (WARN_ON_ONCE(!virt_addr_valid(object))) return; page = virt_to_head_page(object); - if (WARN_ON_ONCE(!PageSlab(compound_head(page)))) { + if (WARN_ON_ONCE(!PageSlab(page))) { pr_cont(" non-slab memory.\n"); return; } -- 2.32.0