From a4244454df1296e90cc961c1b636b1176ef0d9a0 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Sun, 16 Jun 2013 16:12:26 -0700 Subject: percpu-refcount: use RCU-sched insted of normal RCU percpu-refcount was incorrectly using preempt_disable/enable() for RCU critical sections against call_rcu(). 6a24474da8 ("percpu-refcount: consistently use plain (non-sched) RCU") fixed it by converting the preepmtion operations with rcu_read_[un]lock() citing that there isn't any advantage in using sched-RCU over using the usual one; however, rcu_read_[un]lock() for the preemptible RCU implementation - CONFIG_TREE_PREEMPT_RCU, chosen when CONFIG_PREEMPT - are slightly more expensive than preempt_disable/enable(). In a contrived microbench which repeats the followings, - percpu_ref_get() - copy 32 bytes of data into percpu buffer - percpu_put_get() - copy 32 bytes of data into percpu buffer rcu_read_[un]lock() used in percpu_ref_get/put() makes it go slower by about 15% when compared to using sched-RCU. As the RCU critical sections are extremely short, using sched-RCU shouldn't have any latency implications. Convert to RCU-sched. Signed-off-by: Tejun Heo Acked-by: Kent Overstreet Acked-by: "Paul E. McKenney" Cc: Michal Hocko Cc: Rusty Russell --- lib/percpu-refcount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/percpu-refcount.c') diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c index 8bf9e719cca0..7deeb6297a48 100644 --- a/lib/percpu-refcount.c +++ b/lib/percpu-refcount.c @@ -154,5 +154,5 @@ void percpu_ref_kill_and_confirm(struct percpu_ref *ref, (((unsigned long) ref->pcpu_count)|PCPU_REF_DEAD); ref->confirm_kill = confirm_kill; - call_rcu(&ref->rcu, percpu_ref_kill_rcu); + call_rcu_sched(&ref->rcu, percpu_ref_kill_rcu); } -- cgit v1.2.3-59-g8ed1b