lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 15 Jan 2014 09:21:38 +0100
From:	Michal Hocko <mhocko@...e.cz>
To:	Hugh Dickins <hughd@...gle.com>
Cc:	Johannes Weiner <hannes@...xchg.org>,
	Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] mm/memcg: iteration skip memcgs not yet fully
 initialized

On Mon 13-01-14 17:54:04, Hugh Dickins wrote:
> It is surprising that the mem_cgroup iterator can return memcgs which
> have not yet been fully initialized.  By accident (or trial and error?)
> this appears not to present an actual problem; but it may be better to
> prevent such surprises, by skipping memcgs not yet online.
> 
> Signed-off-by: Hugh Dickins <hughd@...gle.com>

This makes a perfect sense now after Tejun pointed out that I was wrong
assuming css_online is called before cgroup is made visible.

Acked-by: Michal Hocko <mhocko@...e.cz>

> ---
> Decide for yourself whether to take this or not.  I spent quite a while
> digging into a mysterious "trying to register non-static key" issue from
> lockdep, which originated from the iterator returning a vmalloc'ed memcg
> a moment before the res_counter_init()s had done their spin_lock_init()s.
> But the backtrace was an odd one of our own mis-devising, not a charge or
> reclaim or stats trace, so probably it's never been a problem for vanilla.
> 
>  mm/memcontrol.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> --- mmotm/mm/memcontrol.c	2014-01-10 18:25:02.236448954 -0800
> +++ linux/mm/memcontrol.c	2014-01-12 22:21:10.700570471 -0800
> @@ -1119,10 +1119,8 @@ skip_node:
>  	 * protected by css_get and the tree walk is rcu safe.
>  	 */
>  	if (next_css) {
> -		struct mem_cgroup *mem = mem_cgroup_from_css(next_css);
> -
> -		if (css_tryget(&mem->css))
> -			return mem;
> +		if ((next_css->flags & CSS_ONLINE) && css_tryget(next_css))
> +			return mem_cgroup_from_css(next_css);
>  		else {
>  			prev_css = next_css;
>  			goto skip_node;

-- 
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ