Thread (35 messages) 35 messages, 7 authors, 2013-04-02

Re: [PATCH 01/10] cgroups: add res_counter_write_u64() API

From: Frederic Weisbecker <hidden>
Date: 2012-02-02 13:56:20
Also in: lkml

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:
quoted
+#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.
quoted
+	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.
quoted
+}
+#endif
-- 
 Kirill A. Shutemov
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help