mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
memcg: fix endless loop in __mem_cgroup_iter_next()
Commit0eef615665
("memcg: fix css reference leak and endless loop in mem_cgroup_iter") got the interaction with the commit a few before itd8ad305597
("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:0eef615665
("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>
This commit is contained in:
parent
5f30fc94ca
commit
ce48225fe3
@ -1127,8 +1127,8 @@ skip_node:
|
||||
* skipping css reference should be safe.
|
||||
*/
|
||||
if (next_css) {
|
||||
if ((next_css->flags & CSS_ONLINE) &&
|
||||
(next_css == &root->css || css_tryget(next_css)))
|
||||
if ((next_css == &root->css) ||
|
||||
((next_css->flags & CSS_ONLINE) && css_tryget(next_css)))
|
||||
return mem_cgroup_from_css(next_css);
|
||||
|
||||
prev_css = next_css;
|
||||
|
Loading…
Reference in New Issue
Block a user