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]
Message-ID: <20150709141320.GH13872@dhcp22.suse.cz>
Date:	Thu, 9 Jul 2015 16:13:21 +0200
From:	Michal Hocko <mhocko@...nel.org>
To:	Vladimir Davydov <vdavydov@...allels.com>
Cc:	Johannes Weiner <hannes@...xchg.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Tejun Heo <tj@...nel.org>, Oleg Nesterov <oleg@...hat.com>,
	Greg Thelen <gthelen@...gle.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	linux-mm@...ck.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 8/8] memcg: get rid of mem_cgroup_from_task

On Wed 08-07-15 20:43:31, Vladimir Davydov wrote:
> On Wed, Jul 08, 2015 at 02:27:52PM +0200, Michal Hocko wrote:
[...]
> > @@ -1091,12 +1079,14 @@ bool task_in_mem_cgroup(struct task_struct *task, struct mem_cgroup *memcg)
> >  		task_unlock(p);
> >  	} else {
> >  		/*
> > -		 * All threads may have already detached their mm's, but the oom
> > -		 * killer still needs to detect if they have already been oom
> > -		 * killed to prevent needlessly killing additional tasks.
> > +		 * All threads have already detached their mm's but we should
> > +		 * still be able to at least guess the original memcg from the
> > +		 * task_css. These two will match most of the time but there are
> > +		 * corner cases where task->mm and task_css refer to a different
> > +		 * cgroups.
> >  		 */
> >  		rcu_read_lock();
> > -		task_memcg = mem_cgroup_from_task(task);
> > +		task_memcg = mem_cgroup_from_css(task_css(task, memory_cgrp_id));
> >  		css_get(&task_memcg->css);
> 
> I wonder why it's safe to call css_get here.

What do you mean by safe? Memcg cannot go away because we are under rcu
lock.

> 
> The patch itself looks good though,
> 
> Reviewed-by: Vladimir Davydov <vdavydov@...allels.com>

Thanks!
-- 
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