]> Git Repo - linux.git/commit
mm/memcg: fix refcount error while moving and swapping
authorHugh Dickins <[email protected]>
Fri, 24 Jul 2020 04:15:24 +0000 (21:15 -0700)
committerLinus Torvalds <[email protected]>
Fri, 24 Jul 2020 19:42:41 +0000 (12:42 -0700)
commit8d22a9351035ef2ff12ef163a1091b8b8cf1e49c
tree9a936bde676b1df6eaa81cb780d65d1c0313b095
parent82ff165cd35110d4e380b55927bbd74dcb564998
mm/memcg: fix refcount error while moving and swapping

It was hard to keep a test running, moving tasks between memcgs with
move_charge_at_immigrate, while swapping: mem_cgroup_id_get_many()'s
refcount is discovered to be 0 (supposedly impossible), so it is then
forced to REFCOUNT_SATURATED, and after thousands of warnings in quick
succession, the test is at last put out of misery by being OOM killed.

This is because of the way moved_swap accounting was saved up until the
task move gets completed in __mem_cgroup_clear_mc(), deferred from when
mem_cgroup_move_swap_account() actually exchanged old and new ids.
Concurrent activity can free up swap quicker than the task is scanned,
bringing id refcount down 0 (which should only be possible when
offlining).

Just skip that optimization: do that part of the accounting immediately.

Fixes: 615d66c37c75 ("mm: memcontrol: fix memcg id ref counter on swap charge move")
Signed-off-by: Hugh Dickins <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Alex Shi <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Alex Shi <[email protected]>
Cc: Shakeel Butt <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
mm/memcontrol.c
This page took 0.051184 seconds and 4 git commands to generate.