From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754022AbbFWH2V (ORCPT ); Tue, 23 Jun 2015 03:28:21 -0400 Received: from hofr.at ([212.69.189.236]:49326 "EHLO mail.hofr.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751207AbbFWH2N (ORCPT ); Tue, 23 Jun 2015 03:28:13 -0400 Date: Tue, 23 Jun 2015 09:28:11 +0200 From: Nicholas Mc Guire To: Peter Zijlstra Cc: oleg@redhat.com, paulmck@linux.vnet.ibm.com, tj@kernel.org, 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: <20150623072811.GB20073@opentech.at> References: <20150622121623.291363374@infradead.org> <20150622122256.064223889@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150622122256.064223889@infradead.org> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A bit off-topic probably but maybe this should not be in kernel/locking/percpu-rwsem.c but in a generic percpu location as this construct is present in the core a few times atleast in: kernel/irq/irqdesc.c:kstat_irqs kernel/fork.c:nr_processes mm/memcontrol.c:mem_cgroup_read_events mm/memcontrol.c:mem_cgroup_read_stat > + > +#define per_cpu_sum(var) \ > +({ \ > + typeof(var) __sum = 0; \ > + int cpu; \ > + for_each_possible_cpu(cpu) \ > + __sum += per_cpu(var, cpu); \ > + __sum; \ > +}) > + so maybe put it into include/linux/percpu.h ? thx! hofrat -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/