diff --git a/mm/memcontrol.c b/mm/memcontrol.c index cf4648416644690f02fdc66b238e96b3546e91b4..30b08fde64819795bb09ae5fcde659e717aa6d5d 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -496,7 +496,7 @@ ino_t page_cgroup_ino(struct page *page) unsigned long ino = 0; rcu_read_lock(); - if (PageHead(page) && PageSlab(page)) + if (PageSlab(page) && !PageTail(page)) memcg = memcg_from_slab_page(page); else memcg = READ_ONCE(page->mem_cgroup); diff --git a/mm/slab.h b/mm/slab.h index 77fd31ea68777eaefede503213deec840af47f59..d8e8b15bcbd34be46005892acd60d1472a4a1d7e 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -259,8 +259,8 @@ static inline struct kmem_cache *memcg_root_cache(struct kmem_cache *s) * Expects a pointer to a slab page. Please note, that PageSlab() check * isn't sufficient, as it returns true also for tail compound slab pages, * which do not have slab_cache pointer set. - * So this function assumes that the page can pass PageHead() and PageSlab() - * checks. + * So this function assumes that the page can pass PageSlab() && !PageTail() + * check. * * The kmem_cache can be reparented asynchronously. The caller must ensure * the memcg lifetime, e.g. by taking rcu_read_lock() or cgroup_mutex.