[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1206252212370.30072@chino.kir.corp.google.com>
Date: Mon, 25 Jun 2012 22:23:59 -0700 (PDT)
From: David Rientjes <rientjes@...gle.com>
To: Andrew Morton <akpm@...ux-foundation.org>
cc: Glauber Costa <glommer@...allels.com>, Tejun Heo <tj@...nel.org>,
cgroups@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Frederic Weisbecker <fweisbec@...il.com>,
Pekka Enberg <penberg@...nel.org>,
Michal Hocko <mhocko@...e.cz>,
Johannes Weiner <hannes@...xchg.org>,
Christoph Lameter <cl@...ux.com>, devel@...nvz.org,
kamezawa.hiroyu@...fujitsu.com,
Pekka Enberg <penberg@...helsinki.fi>,
Suleiman Souhlal <suleiman@...gle.com>
Subject: Re: [PATCH 09/11] memcg: propagate kmem limiting information to
children
On Mon, 25 Jun 2012, Andrew Morton wrote:
> > >> */
> > >> bool use_hierarchy;
> > >> - bool kmem_accounted;
> > >> + /*
> > >> + * bit0: accounted by this cgroup
> > >> + * bit1: accounted by a parent.
> > >> + */
> > >> + volatile unsigned long kmem_accounted;
> > >
> > > Is the volatile declaration really necessary? Why is it necessary?
> > > Why no comment explaining it?
> >
> > Seems to be required by set_bit and friends. gcc will complain if it is
> > not volatile (take a look at the bit function headers)
>
> That would be a broken gcc. We run test_bit()/set_bit() and friends
> against plain old `unsigned long' in thousands of places. There's
> nothing special about this one!
>
No version of gcc would complain about this, even with 4.6 and later with
-fstrict-volatile-bitfields, it's a qualifier that determines whether or
not the access to memory is the exact size of the bitfield and aligned to
its natural boundary. If the type isn't qualified as such then it's
simply going to compile to access the native word size of the
architecture. No special consideration is needed for a member of
struct mem_cgroup.
--
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