提交 65dff3b2 编写于 作者: H Hugh Dickins 提交者: Zheng Zengkai

mm/memcg: fix 5.10 backport of splitting page memcg

stable inclusion
from stable-5.10.27
commit 002ea848d7fd3bdcb6281e75bdde28095c2cd549
bugzilla: 51493

--------------------------------

The straight backport of 5.12's e1baddf8 ("mm/memcg: set memcg when
splitting page") works fine in 5.11, but turned out to be wrong for 5.10:
because that relies on a separate flag, which must also be set for the
memcg to be recognized and uncharged and cleared when freeing. Fix that.
Signed-off-by: NHugh Dickins <hughd@google.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: N  Weilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 ab000ba0
......@@ -3274,13 +3274,17 @@ void obj_cgroup_uncharge(struct obj_cgroup *objcg, size_t size)
void split_page_memcg(struct page *head, unsigned int nr)
{
struct mem_cgroup *memcg = head->mem_cgroup;
int kmemcg = PageKmemcg(head);
int i;
if (mem_cgroup_disabled() || !memcg)
return;
for (i = 1; i < nr; i++)
for (i = 1; i < nr; i++) {
head[i].mem_cgroup = memcg;
if (kmemcg)
__SetPageKmemcg(head + i);
}
css_get_many(&memcg->css, nr - 1);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册