Skip to content

Commit 78370df

Browse files
urezkiNeeraj Upadhyay (AMD)
authored andcommitted
rcu: Enable rcu_normal_wake_from_gp on small systems
Automatically enable the rcu_normal_wake_from_gp parameter on systems with a small number of CPUs. The activation threshold is set to 16 CPUs. This helps to reduce a latency of normal synchronize_rcu() API by waking up GP-waiters earlier and decoupling synchronize_rcu() callers from regular callback handling. A benchmark running 64 parallel jobs(system with 64 CPUs) invoking synchronize_rcu() demonstrates a notable latency reduction with the setting enabled. Latency distribution (microseconds): <default> 0 - 9999 : 1 10000 - 19999 : 4 20000 - 29999 : 399 30000 - 39999 : 3197 40000 - 49999 : 10428 50000 - 59999 : 17363 60000 - 69999 : 15529 70000 - 79999 : 9287 80000 - 89999 : 4249 90000 - 99999 : 1915 100000 - 109999 : 922 110000 - 119999 : 390 120000 - 129999 : 187 ... <default> <rcu_normal_wake_from_gp> 0 - 9999 : 1 10000 - 19999 : 234 20000 - 29999 : 6678 30000 - 39999 : 33463 40000 - 49999 : 20669 50000 - 59999 : 2766 60000 - 69999 : 183 ... <rcu_normal_wake_from_gp> Reviewed-by: Joel Fernandes <[email protected]> Signed-off-by: Uladzislau Rezki (Sony) <[email protected]> Reviewed-by: Frederic Weisbecker <[email protected]> Signed-off-by: Neeraj Upadhyay (AMD) <[email protected]>
1 parent 90c09d5 commit 78370df

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

kernel/rcu/tree.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,8 +1632,10 @@ static void rcu_sr_put_wait_head(struct llist_node *node)
16321632
atomic_set_release(&sr_wn->inuse, 0);
16331633
}
16341634

1635-
/* Disabled by default. */
1636-
static int rcu_normal_wake_from_gp;
1635+
/* Enable rcu_normal_wake_from_gp automatically on small systems. */
1636+
#define WAKE_FROM_GP_CPU_THRESHOLD 16
1637+
1638+
static int rcu_normal_wake_from_gp = -1;
16371639
module_param(rcu_normal_wake_from_gp, int, 0644);
16381640
static struct workqueue_struct *sync_wq;
16391641

@@ -3250,7 +3252,7 @@ static void synchronize_rcu_normal(void)
32503252

32513253
trace_rcu_sr_normal(rcu_state.name, &rs.head, TPS("request"));
32523254

3253-
if (!READ_ONCE(rcu_normal_wake_from_gp)) {
3255+
if (READ_ONCE(rcu_normal_wake_from_gp) < 1) {
32543256
wait_rcu_gp(call_rcu_hurry);
32553257
goto trace_complete_out;
32563258
}
@@ -4854,6 +4856,12 @@ void __init rcu_init(void)
48544856
sync_wq = alloc_workqueue("sync_wq", WQ_MEM_RECLAIM, 0);
48554857
WARN_ON(!sync_wq);
48564858

4859+
/* Respect if explicitly disabled via a boot parameter. */
4860+
if (rcu_normal_wake_from_gp < 0) {
4861+
if (num_possible_cpus() <= WAKE_FROM_GP_CPU_THRESHOLD)
4862+
rcu_normal_wake_from_gp = 1;
4863+
}
4864+
48574865
/* Fill in default value for rcutree.qovld boot parameter. */
48584866
/* -After- the rcu_node ->lock fields are initialized! */
48594867
if (qovld < 0)

0 commit comments

Comments
 (0)