Commit 132e1a23 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: per_cpu_sum()

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 63567f64
......@@ -698,14 +698,19 @@ do { \
} \
} while (0)
#define per_cpu_sum(_p) \
({ \
typeof(*_p) _ret = 0; \
\
int cpu; \
for_each_possible_cpu(cpu) \
_ret += *per_cpu_ptr(_p, cpu); \
_ret; \
})
static inline u64 percpu_u64_get(u64 __percpu *src)
{
u64 ret = 0;
int cpu;
for_each_possible_cpu(cpu)
ret += *per_cpu_ptr(src, cpu);
return ret;
return per_cpu_sum(src);
}
static inline void percpu_u64_set(u64 __percpu *dst, u64 src)
......
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