Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751100AbbF2PMa (ORCPT ); Mon, 29 Jun 2015 11:12:30 -0400 Received: from mail-yk0-f180.google.com ([209.85.160.180]:35593 "EHLO mail-yk0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752374AbbF2PMX (ORCPT ); Mon, 29 Jun 2015 11:12:23 -0400 Date: Mon, 29 Jun 2015 11:12:20 -0400 From: Tejun Heo To: Peter Zijlstra Cc: Nicholas Mc Guire , oleg@redhat.com, paulmck@linux.vnet.ibm.com, mingo@redhat.com, linux-kernel@vger.kernel.org, dave@stgolabs.net, riel@redhat.com, viro@ZenIV.linux.org.uk, torvalds@linux-foundation.org Subject: Re: [RFC][PATCH 05/13] percpu-rwsem: Optimize readers and reduce global impact Message-ID: <20150629151220.GL15805@mtj.duckdns.org> References: <20150622121623.291363374@infradead.org> <20150622122256.064223889@infradead.org> <20150623072811.GB20073@opentech.at> <20150625190800.GW19282@twins.programming.kicks-ass.net> <20150625191701.GA5013@mtj.duckdns.org> <20150629093219.GD3644@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150629093219.GD3644@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 901 Lines: 36 Hello, Peter. On Mon, Jun 29, 2015 at 11:32:19AM +0200, Peter Zijlstra wrote: > Agreed, luckily we already have the infrastructure for this, something > like so? > > --- a/include/linux/percpu-defs.h > +++ b/include/linux/percpu-defs.h > @@ -287,6 +287,16 @@ do { \ > preempt_enable(); \ > } while (0) > > +#define per_cpu_sum(var) \ > +({ \ > + typeof(var) __sum = 0; \ > + int cpu; \ Why not __cpu? > + compiletime_assert_atomic_type(__sum); \ > + for_each_possible_cpu(cpu) \ > + __sum += per_cpu(var, cpu); \ > + __sum; \ > +}) But other than that, looks good to me. Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/