projects
/
linux-2.6-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
63567f6
)
bcachefs: per_cpu_sum()
author
Kent Overstreet
<kent.overstreet@linux.dev>
Thu, 13 Jun 2024 18:11:48 +0000
(14:11 -0400)
committer
Kent Overstreet
<kent.overstreet@linux.dev>
Sun, 14 Jul 2024 23:00:15 +0000
(19:00 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/util.h
patch
|
blob
|
blame
|
history
diff --git
a/fs/bcachefs/util.h
b/fs/bcachefs/util.h
index cd09edd12d8a5f8b3d0203ce27ebb90ab1a72b5f..2def4f761ca6430bc360d086d5faa7997aa212db 100644
(file)
--- a/
fs/bcachefs/util.h
+++ b/
fs/bcachefs/util.h
@@
-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)