diff options
author | Hugh Dickins <hughd@google.com> | 2021-03-29 03:13:13 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-30 15:32:07 +0300 |
commit | 002ea848d7fd3bdcb6281e75bdde28095c2cd549 (patch) | |
tree | f94a204917adc1a7b4c20a409da944fcf556cf23 /mm | |
parent | 2c163520e12b6551e6482491b3cad3c84daa4626 (diff) | |
download | linux-002ea848d7fd3bdcb6281e75bdde28095c2cd549.tar.xz |
mm/memcg: fix 5.10 backport of splitting page memcg
The straight backport of 5.12's e1baddf8475b ("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: Hugh Dickins <hughd@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memcontrol.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index dda4223d3ff9..d72d2b90474a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -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); } |