lkml.org 
[lkml]   [2011]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/8] cgroups: Add res_counter_write_u64() API
    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.

    Oleg.



    \
     
     \ /
      Last update: 2011-08-09 17:23    [W:4.634 / U:0.208 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site