• Hugh Dickins's avatar
    memcg: fix endless loop in __mem_cgroup_iter_next() · ce48225f
    Hugh Dickins authored
    Commit 0eef6156 ("memcg: fix css reference leak and endless loop in
    mem_cgroup_iter") got the interaction with the commit a few before it
    d8ad3055 ("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: 0eef6156 ("memcg: fix css reference leak and endless loop in mem_cgroup_iter").
    Signed-off-by: default avatarHugh Dickins <hughd@google.com>
    Acked-by: default avatarMichal 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: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    ce48225f
memcontrol.c 194 KB