The patch titled Subject: mm: memcontrol: fix forget to obtain the ref to objcg in split_page_memcg has been removed from the -mm tree. Its filename was mm-memcontrol-use-obj_cgroup-apis-to-charge-kmem-pages-fix.patch This patch was dropped because it was folded into mm-memcontrol-use-obj_cgroup-apis-to-charge-kmem-pages.patch ------------------------------------------------------ From: Muchun Song <songmuchun@xxxxxxxxxxxxx> Subject: mm: memcontrol: fix forget to obtain the ref to objcg in split_page_memcg Christian Borntraeger reported a warning about "percpu ref (obj_cgroup_release) <= 0 (-1) after switching to atomic". Because we forgot to obtain the reference to the objcg and wrongly obtain the reference of memcg. Link: https://lkml.kernel.org/r/20210401030141.37061-1-songmuchun@xxxxxxxxxxxxx Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx> Reported-by: Christian Borntraeger <borntraeger@xxxxxxxxxx> Acked-by: Roman Gushchin <guro@xxxxxx> Reviewed-by: Miaohe Lin <linmiaohe@xxxxxxxxxx> Cc: Xiongchun Duan <duanxiongchun@xxxxxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Shakeel Butt <shakeelb@xxxxxxxxxx> Cc: Vladimir Davydov <vdavydov.dev@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/memcontrol.h | 6 ++++++ mm/memcontrol.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) --- a/include/linux/memcontrol.h~mm-memcontrol-use-obj_cgroup-apis-to-charge-kmem-pages-fix +++ a/include/linux/memcontrol.h @@ -798,6 +798,12 @@ static inline void obj_cgroup_get(struct percpu_ref_get(&objcg->refcnt); } +static inline void obj_cgroup_get_many(struct obj_cgroup *objcg, + unsigned long nr) +{ + percpu_ref_get_many(&objcg->refcnt, nr); +} + static inline void obj_cgroup_put(struct obj_cgroup *objcg) { percpu_ref_put(&objcg->refcnt); --- a/mm/memcontrol.c~mm-memcontrol-use-obj_cgroup-apis-to-charge-kmem-pages-fix +++ a/mm/memcontrol.c @@ -3270,7 +3270,11 @@ void split_page_memcg(struct page *head, for (i = 1; i < nr; i++) head[i].memcg_data = head->memcg_data; - css_get_many(&memcg->css, nr - 1); + + if (PageMemcgKmem(head)) + obj_cgroup_get_many(__page_objcg(head), nr - 1); + else + css_get_many(&memcg->css, nr - 1); } #ifdef CONFIG_MEMCG_SWAP _ Patches currently in -mm which might be from songmuchun@xxxxxxxxxxxxx are mm-memcontrol-fix-kernel-stack-account.patch mm-memcontrol-slab-fix-obtain-a-reference-to-a-freeing-memcg.patch mm-memcontrol-introduce-obj_cgroup_uncharge_pages.patch mm-memcontrol-directly-access-page-memcg_data-in-mm-page_allocc.patch mm-memcontrol-change-ug-dummy_page-only-if-memcg-changed.patch mm-memcontrol-use-obj_cgroup-apis-to-charge-kmem-pages.patch mm-memcontrol-inline-__memcg_kmem_uncharge-into-obj_cgroup_uncharge_pages.patch mm-memcontrol-move-pagememcgkmem-to-the-scope-of-config_memcg_kmem.patch