]> git.baikalelectronics.ru Git - kernel.git/commit
memcg: fix endless loop in __mem_cgroup_iter_next()
authorHugh Dickins <hughd@google.com>
Mon, 3 Mar 2014 23:38:24 +0000 (15:38 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 4 Mar 2014 15:55:47 +0000 (07:55 -0800)
commit520283b7680272072eb20c893bc235f44e882e76
tree9272e2e025f1bc01e0930c60e070b2a5d767e375
parentfa8a5b07d1331a4cff6b9e9cdc9424719c20c12e
memcg: fix endless loop in __mem_cgroup_iter_next()

Commit b25c4dd0171d ("memcg: fix css reference leak and endless loop in
mem_cgroup_iter") got the interaction with the commit a few before it
adc9348165db ("mm/memcg: iteration skip memcgs not yet fully
initialized") slightly wrong, and we didn't notice at the time.

It's elusive, and harder to get than the original, but for a couple of
days before rc1, I several times saw a endless loop similar to that
supposedly being fixed.

This time it was a tighter loop in __mem_cgroup_iter_next(): because we
can get here when our root has already been offlined, and the ordering
of conditions was such that we then just cycled around forever.

Fixes: b25c4dd0171d ("memcg: fix css reference leak and endless loop in mem_cgroup_iter").
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Greg Thelen <gthelen@google.com>
Cc: <stable@vger.kernel.org> [3.12+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memcontrol.c