Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932911AbWCVWjw (ORCPT ); Wed, 22 Mar 2006 17:39:52 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932899AbWCVWgV (ORCPT ); Wed, 22 Mar 2006 17:36:21 -0500 Received: from amsfep17-int.chello.nl ([213.46.243.15]:63537 "EHLO amsfep14-int.chello.nl") by vger.kernel.org with ESMTP id S932888AbWCVWfp (ORCPT ); Wed, 22 Mar 2006 17:35:45 -0500 From: Peter Zijlstra To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Bob Picco , Andrew Morton , IWAMOTO Toshihiro , Peter Zijlstra , Christoph Lameter , Wu Fengguang , Nick Piggin , Linus Torvalds , Rik van Riel , Marcelo Tosatti Message-Id: <20060322223511.12658.80845.sendpatchset@twins.localnet> In-Reply-To: <20060322223107.12658.14997.sendpatchset@twins.localnet> References: <20060322223107.12658.14997.sendpatchset@twins.localnet> Subject: [PATCH 24/34] mm: sum_cpu_var.patch Date: Wed, 22 Mar 2006 23:35:43 +0100 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1211 Lines: 34 From: Peter Zijlstra Much used per_cpu op by the additional policies. Signed-off-by: Peter Zijlstra Signed-off-by: Marcelo Tosatti --- include/linux/percpu.h | 5 +++++ 1 file changed, 5 insertions(+) Index: linux-2.6/include/linux/percpu.h =================================================================== --- linux-2.6.orig/include/linux/percpu.h 2006-03-13 20:38:20.000000000 +0100 +++ linux-2.6/include/linux/percpu.h 2006-03-13 20:45:24.000000000 +0100 @@ -15,6 +15,11 @@ #define get_cpu_var(var) (*({ preempt_disable(); &__get_cpu_var(var); })) #define put_cpu_var(var) preempt_enable() +#define __sum_cpu_var(type, var) ({ __typeof__(type) sum = 0; \ + int cpu; \ + for_each_cpu(cpu) sum += per_cpu(var, cpu); \ + sum; }) + #ifdef CONFIG_SMP struct percpu_data { - 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/