Re: [PATCH 1/8] cgroups: Add res_counter_write_u64() API

From: Frederic Weisbecker
Date: Tue Aug 09 2011 - 13:31:32 EST


On Tue, Aug 09, 2011 at 05:17:39PM +0200, Oleg Nesterov wrote:
> On 07/29, Frederic Weisbecker wrote:
> >
> > +void res_counter_write_u64(struct res_counter *counter, int member, u64 val)
> > +{
> > + unsigned long long *target;
> > + unsigned long flags;
> > +
> > + spin_lock_irqsave(&counter->lock, flags);
> > + target = res_counter_member(counter, member);
> > + *target = val;
> > + spin_unlock_irqrestore(&counter->lock, flags);
> > +}
>
> Hmm. Why do we need counter->lock?
>
> OK, probably it is for BITS_PER_LONG < 64. May be it makes sense
> to ifdef, just to make the code more understandable.

Ok, will add that.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/