From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753217Ab0IQJeK (ORCPT ); Fri, 17 Sep 2010 05:34:10 -0400 Received: from bombadil.infradead.org ([18.85.46.34]:48970 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752215Ab0IQJeH (ORCPT ); Fri, 17 Sep 2010 05:34:07 -0400 Message-Id: <20100917093009.252867712@chello.nl> User-Agent: quilt/0.47-1 Date: Fri, 17 Sep 2010 11:28:45 +0200 From: Peter Zijlstra To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Stephane Eranian , Robert Richter , Tejun Heo , Peter Zijlstra Subject: [PATCH 1/6] percpu: {get,put}_cpu_ptr References: <20100917092844.651383640@chello.nl> Content-Disposition: inline; filename=percpu-get-cpu-ptr.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Similar to {get,put}_cpu_var() except for dynamically allocated per-cpu memory. Cc: Tejun Heo Signed-off-by: Peter Zijlstra --- include/linux/percpu.h | 9 +++++++++ 1 file changed, 9 insertions(+) Index: linux-2.6/include/linux/percpu.h =================================================================== --- linux-2.6.orig/include/linux/percpu.h +++ linux-2.6/include/linux/percpu.h @@ -39,6 +39,15 @@ preempt_enable(); \ } while (0) +#define get_cpu_ptr(var) ({ \ + preempt_disable(); \ + this_cpu_ptr(var); }) + +#define put_cpu_ptr(var) do { \ + (void)(var); \ + preempt_enable(); \ +} while (0) + #ifdef CONFIG_SMP /* minimum unit size, also is the maximum supported allocation size */