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];
#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())
static inline void percpu_modcopy(void *pcpudst, const void *src,
unsigned long size)
{
unsigned int i;
for (i = 0; i < NR_CPUS; i++)
if (cpu_possible(i))
memcpy(pcpudst + __per_cpu_offset[i], src, size);
}
/* A macro to avoid #include hell... */
#define percpu_modcopy(pcpudst, src, size) \
do { \
unsigned int __i; \
for (__i = 0; __i < NR_CPUS; __i++) \
if (cpu_possible(__i)) \
memcpy((pcpudst)+__per_cpu_offset[__i], \
(src), (size)); \
} while (0)
#else /* ! SMP */
#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