[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100223115846.GI1882@linux>
Date: Tue, 23 Feb 2010 12:58:46 +0100
From: Andrea Righi <arighi@...eler.com>
To: Vivek Goyal <vgoyal@...hat.com>
Cc: David Rientjes <rientjes@...gle.com>,
Balbir Singh <balbir@...ux.vnet.ibm.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.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
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.
Thanks!
-Andrea
--
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