diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-06-10 23:34:02 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2022-03-12 20:12:55 -0500 |
commit | 846dbb230596815cea8b2fac0162e0bfab41a8a1 (patch) | |
tree | e6b5d9830b515beb4f97c8b8402081c7d9453cf3 | |
parent | 5193f282c64b6f6048760cbaa51b564f290760f9 (diff) |
bcachefs: Don't disable preemption unnecessarily
Small improvements to some percpu utility code.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | fs/bcachefs/util.c | 6 | ||||
-rw-r--r-- | fs/bcachefs/util.h | 5 |
2 files changed, 2 insertions, 9 deletions
diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c index e3ad26e244ab..463260c04585 100644 --- a/fs/bcachefs/util.c +++ b/fs/bcachefs/util.c @@ -887,13 +887,9 @@ void eytzinger0_find_test(void) */ u64 *bch2_acc_percpu_u64s(u64 __percpu *p, unsigned nr) { - u64 *ret; + u64 *ret = this_cpu_ptr(p); int cpu; - preempt_disable(); - ret = this_cpu_ptr(p); - preempt_enable(); - for_each_possible_cpu(cpu) { u64 *i = per_cpu_ptr(p, cpu); diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h index 2cf8568e630b..bec84d8aabed 100644 --- a/fs/bcachefs/util.h +++ b/fs/bcachefs/util.h @@ -711,10 +711,7 @@ static inline void percpu_u64_set(u64 __percpu *dst, u64 src) for_each_possible_cpu(cpu) *per_cpu_ptr(dst, cpu) = 0; - - preempt_disable(); - *this_cpu_ptr(dst) = src; - preempt_enable(); + this_cpu_write(*dst, src); } static inline void acc_u64s(u64 *acc, const u64 *src, unsigned nr) |