Skip to content

Commit

Permalink
bcachefs: Don't disable preemption unnecessarily
Browse files Browse the repository at this point in the history
Small improvements to some percpu utility code.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
  • Loading branch information
koverstreet committed Jun 15, 2021
1 parent cd5ec1b commit 0f341e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
6 changes: 1 addition & 5 deletions fs/bcachefs/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 1 addition & 4 deletions fs/bcachefs/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,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)
Expand Down

0 comments on commit 0f341e2

Please sign in to comment.