Skip to content

Commit a48a4ab

Browse files
joelagnelchantra
authored andcommitted
percpu-refcount: Use call_rcu_flush() for atomic switch
call_rcu() changes to save power will slow down the percpu refcounter's "per-CPU to atomic switch" path. The primitive uses RCU when switching to atomic mode. The enqueued async callback wakes up waiters waiting in the percpu_ref_switch_waitq. Due to this, per-CPU refcount users will slow down, such as blk_pre_runtime_suspend(). Use the call_rcu_flush() API instead which reverts to the old behavior. Signed-off-by: Joel Fernandes (Google) <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 06cbc18 commit a48a4ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/percpu-refcount.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ static void __percpu_ref_switch_to_atomic(struct percpu_ref *ref,
230230
percpu_ref_noop_confirm_switch;
231231

232232
percpu_ref_get(ref); /* put after confirmation */
233-
call_rcu(&ref->data->rcu, percpu_ref_switch_to_atomic_rcu);
233+
call_rcu_flush(&ref->data->rcu,
234+
percpu_ref_switch_to_atomic_rcu);
234235
}
235236

236237
static void __percpu_ref_switch_to_percpu(struct percpu_ref *ref)

0 commit comments

Comments
 (0)