From mboxrd@z Thu Jan 1 00:00:00 1970 From: Frederic Weisbecker Subject: Re: [PATCH 01/10] cgroups: add res_counter_write_u64() API Date: Thu, 2 Feb 2012 14:56:11 +0100 Message-ID: <20120202135609.GB9071@somewhere.redhat.com> References: <1328067470-5980-1-git-send-email-fweisbec@gmail.com> <1328067470-5980-2-git-send-email-fweisbec@gmail.com> <20120202123322.GA12748@shutemov.name> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20120202123322.GA12748-oKw7cIdHH8eLwutG50LtGA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: "Kirill A. Shutemov" Cc: Aditya Kali , Tejun Heo , "Daniel P. Berrange" , Max Kellermann , Tim Hockin , Glauber Costa , Containers , Daniel J Walsh , LKML , Oleg Nesterov , Johannes Weiner , Tejun Heo , Cgroups , Andrew Morton , Mandeep Singh Baines List-Id: containers.vger.kernel.org On Thu, Feb 02, 2012 at 02:33:22PM +0200, Kirill A. Shutemov wrote: > On Wed, Feb 01, 2012 at 04:37:41AM +0100, Frederic Weisbecker wrote: > > +#if BITS_PER_LONG == 32 > > +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; > > Nitpick: What's the point to have temporary variable here? Dunno, just a matter of habit, I use to avoid expressions like *func(foo) = bar. It looks less readable to me but perhaps it's because I'm not used to it. > > > + spin_unlock_irqrestore(&counter->lock, flags); > > +} > > +#else > > +void res_counter_write_u64(struct res_counter *counter, int member, u64 val) > > +{ > > + unsigned long long *target; > > + > > + target = res_counter_member(counter, member); > > + *target = val; > > Ditto. > > > +} > > +#endif > > -- > Kirill A. Shutemov