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: <28c262361002252050r29f54ea2u6c6e87f1f702d195@mail.gmail.com>
Date:	Fri, 26 Feb 2010 13:50:04 +0900
From:	Minchan Kim <minchan.kim@...il.com>
To:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc:	Andrea Righi <arighi@...eler.com>, Vivek Goyal <vgoyal@...hat.com>,
	David Rientjes <rientjes@...gle.com>,
	Balbir Singh <balbir@...ux.vnet.ibm.com>,
	Suleiman Souhlal <suleiman@...gle.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	containers@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] memcg: dirty pages accounting and limiting 
	infrastructure

Hi, Kame.

On Fri, Feb 26, 2010 at 9:23 AM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@...fujitsu.com> wrote:
> On Fri, 26 Feb 2010 00:36:15 +0900
> Minchan Kim <minchan.kim@...il.com> wrote:
>
>> Hi
>>
>> On Tue, Feb 23, 2010 at 8:58 PM, Andrea Righi <arighi@...eler.com> wrote:
>> > On Mon, Feb 22, 2010 at 01:07:32PM -0500, Vivek Goyal wrote:
>> >> > > > +unsigned long mem_cgroup_dirty_bytes(void)
>> >> > > > +{
>> >> > > > +       struct mem_cgroup *memcg;
>> >> > > > +       unsigned long dirty_bytes;
>> >> > > > +
>> >> > > > +       if (mem_cgroup_disabled())
>> >> > > > +               return vm_dirty_bytes;
>> >> > > > +
>> >> > > > +       rcu_read_lock();
>> >> > > > +       memcg = mem_cgroup_from_task(current);
>> >> > > > +       if (memcg == NULL)
>> >> > > > +               dirty_bytes = vm_dirty_bytes;
>> >> > > > +       else
>> >> > > > +               dirty_bytes = get_dirty_bytes(memcg);
>> >> > > > +       rcu_read_unlock();
>> >> > >
>> >> > > The rcu_read_lock() isn't protecting anything here.
>> >> >
>> >> > Right!
>> >>
>> >> Are we not protecting "memcg" pointer using rcu here?
>> >
>> > Vivek, you are right:
>> >
>> >  mem_cgroup_from_task() -> task_subsys_state() -> rcu_dereference()
>> >
>> > So, this *must* be RCU protected.
>>
>> So, Doesn't mem_cgroup_from_task in mem_cgroup_can_attach need RCU, too?
>>
> Hm ? I don't read the whole thread but can_attach() is called under
> cgroup_mutex(). So, it doesn't need to use RCU.

Vivek mentioned memcg is protected by RCU if I understand his intention right.
So I commented that without enough knowledge of memcg.
After your comment, I dive into the code.

Just out of curiosity.

Really, memcg is protected by RCU?
I think most of RCU around memcg is for protecting task_struct and
cgroup_subsys_state.
The memcg is protected by cgroup_mutex as you mentioned.
Am I missing something?

> Thanks,
> -Kame
>
>
>



-- 
Kind regards,
Minchan Kim
--
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