lkml.org 
[lkml]   [2011]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Code clean up for percpu_xxx() functions
On Tue, 11 Oct 2011, Alex,Shi wrote:

> percpu_read() used in asm/percpu.h yet. Anyway, I removed definitions
> here and do a work around for the function as following:
>
> @@ -551,7 +544,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

OK that looks okay.

> Signed-off-by: Alex Shi <alex.shi@intel.com>

Is this a revised patch? I do not see a use of the __this_cpu_xx ops.

> -#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_stable(var) percpu_from_op("mov", var, "p" (&(var)))
> +#define this_cpu_inc(var) percpu_unary_op("inc", var)

Why redefine this_cpu_inc? include/linux/percpu.h already defines it.



\
 
 \ /
  Last update: 2011-10-11 16:15    [from the cache]
©2003-2011 Jasper Spaans