From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758412Ab2AMPrX (ORCPT ); Fri, 13 Jan 2012 10:47:23 -0500 Received: from mga02.intel.com ([134.134.136.20]:62653 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932292Ab2AMPrT (ORCPT ); Fri, 13 Jan 2012 10:47:19 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.67,352,1309762800"; d="scan'208";a="96168497" From: Alex Shi To: linux-kernel@vger.kernel.org, cl@gentwo.org, eric.dumazet@gmail.com, tglx@linutronix.de, avi@redhat.com, akpm@linux-foundation.org, davem@davemloft.net, kaber@trash.net, a.p.zijlstra@chello.nl, ying.huang@intel.com, honrad.wilk@oracle.com, hpa@zytor.com, jeremy@goop.org Subject: [PATCH v2 5/5] x86: Code clean up for percpu_xxx() functions Date: Fri, 13 Jan 2012 23:45:20 +0800 Message-Id: <1326469520-21239-6-git-send-email-alex.shi@intel.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1326469520-21239-5-git-send-email-alex.shi@intel.com> References: <1326469520-21239-1-git-send-email-alex.shi@intel.com> <1326469520-21239-2-git-send-email-alex.shi@intel.com> <1326469520-21239-3-git-send-email-alex.shi@intel.com> <1326469520-21239-4-git-send-email-alex.shi@intel.com> <1326469520-21239-5-git-send-email-alex.shi@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is no percpu_xxx serial code in kerenl, so safly remove them. Signed-off-by: Alex Shi Acked-by: Christoph Lameter Acked-by: Tejun Heo --- arch/x86/include/asm/percpu.h | 16 ++++------- include/linux/percpu.h | 54 ----------------------------------------- 2 files changed, 6 insertions(+), 64 deletions(-) diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index 8d256ad..ed3e18a 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h @@ -351,7 +351,7 @@ do { \ }) /* - * percpu_read() makes gcc load the percpu variable every time it is + * this_cpu_read() makes gcc load the percpu variable every time it is * accessed while this_cpu_read_stable() allows the value to be cached. * this_cpu_read_stable() is more efficient and can be used if its value * is guaranteed to be valid across cpus. The current users include @@ -359,15 +359,7 @@ do { \ * per-thread variables implemented as per-cpu variables and thus * stable for the duration of the respective task. */ -#define percpu_read(var) percpu_from_op("mov", var, "m" (var)) #define this_cpu_read_stable(var) percpu_from_op("mov", var, "p" (&(var))) -#define percpu_write(var, val) percpu_to_op("mov", var, val) -#define percpu_add(var, val) percpu_add_op(var, val) -#define percpu_sub(var, val) percpu_add_op(var, -(val)) -#define percpu_and(var, val) percpu_to_op("and", var, val) -#define percpu_or(var, val) percpu_to_op("or", var, val) -#define percpu_xor(var, val) percpu_to_op("xor", var, val) -#define percpu_inc(var) percpu_unary_op("inc", var) #define __this_cpu_read_1(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) #define __this_cpu_read_2(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) @@ -512,7 +504,11 @@ static __always_inline int x86_this_cpu_constant_test_bit(unsigned int nr, { unsigned long __percpu *a = (unsigned long *)addr + nr / BITS_PER_LONG; - return ((1UL << (nr % BITS_PER_LONG)) & percpu_read(*a)) != 0; +#ifdef CONFIG_X86_64 + return ((1UL << (nr % BITS_PER_LONG)) & __this_cpu_read_8(*a)) != 0; +#else + return ((1UL << (nr % BITS_PER_LONG)) & __this_cpu_read_4(*a)) != 0; +#endif } static inline int x86_this_cpu_variable_test_bit(int nr, diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 32cd1f6..6e68d05 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h @@ -166,60 +166,6 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr); (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) /* - * Optional methods for optimized non-lvalue per-cpu variable access. - * - * @var can be a percpu variable or a field of it and its size should - * equal char, int or long. percpu_read() evaluates to a lvalue and - * all others to void. - * - * These operations are guaranteed to be atomic. - * The generic versions disable interrupts. Archs are - * encouraged to implement single-instruction alternatives which don't - * require protection. - */ -#ifndef percpu_read -# define percpu_read(var) \ - ({ \ - typeof(var) *pr_ptr__ = &(var); \ - typeof(var) pr_ret__; \ - pr_ret__ = get_cpu_var(*pr_ptr__); \ - put_cpu_var(*pr_ptr__); \ - pr_ret__; \ - }) -#endif - -#define __percpu_generic_to_op(var, val, op) \ -do { \ - typeof(var) *pgto_ptr__ = &(var); \ - get_cpu_var(*pgto_ptr__) op val; \ - put_cpu_var(*pgto_ptr__); \ -} while (0) - -#ifndef percpu_write -# define percpu_write(var, val) __percpu_generic_to_op(var, (val), =) -#endif - -#ifndef percpu_add -# define percpu_add(var, val) __percpu_generic_to_op(var, (val), +=) -#endif - -#ifndef percpu_sub -# define percpu_sub(var, val) __percpu_generic_to_op(var, (val), -=) -#endif - -#ifndef percpu_and -# define percpu_and(var, val) __percpu_generic_to_op(var, (val), &=) -#endif - -#ifndef percpu_or -# define percpu_or(var, val) __percpu_generic_to_op(var, (val), |=) -#endif - -#ifndef percpu_xor -# define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=) -#endif - -/* * Branching function to split up a function into a set of functions that * are called for different scalar sizes of the objects handled. */ -- 1.6.3.3