Commit a26698b4 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] Make percpu_modcopy a macro

davidm@hpl.hp.com writes:
  "I'm working on updating the ia64 tree with local_t etc.  One
   thing that would really help me: could you make
   asm-generic/percpu_modcopy() a macro?  The routine depends on
   cpu_possible(), but I can't including smp.h in percpu.h since
   that would lead to recusive header-file dependencies (and in my
   opinion, percpu.h should be more "primitive" than smp.h, so that
   it can be included virtually everywhere)."
parent 38fe9ed4
...@@ -15,14 +15,15 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; ...@@ -15,14 +15,15 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
#define __get_cpu_var(var) per_cpu(var, smp_processor_id()) #define __get_cpu_var(var) per_cpu(var, smp_processor_id())
static inline void percpu_modcopy(void *pcpudst, const void *src, /* A macro to avoid #include hell... */
unsigned long size) #define percpu_modcopy(pcpudst, src, size) \
{ do { \
unsigned int i; unsigned int __i; \
for (i = 0; i < NR_CPUS; i++) for (__i = 0; __i < NR_CPUS; __i++) \
if (cpu_possible(i)) if (cpu_possible(__i)) \
memcpy(pcpudst + __per_cpu_offset[i], src, size); memcpy((pcpudst)+__per_cpu_offset[__i], \
} (src), (size)); \
} while (0)
#else /* ! SMP */ #else /* ! SMP */
#define DEFINE_PER_CPU(type, name) \ #define DEFINE_PER_CPU(type, name) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment