Skip to content

Commit b0afa0f

Browse files
committed
rcu-tasks: Provide boot parameter to delay IPIs until late in grace period
This commit provides a rcupdate.rcu_task_ipi_delay kernel boot parameter that specifies how old the RCU tasks trace grace period must be before the grace-period kthread starts sending IPIs. This delay allows more tasks to pass through rcu_tasks_qs() quiescent states, thus reducing (or even eliminating) the number of IPIs that must be sent. On a short rcutorture test setting this kernel boot parameter to HZ/2 resulted in zero IPIs for all 877 RCU-tasks trace grace periods that elapsed during that test. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 88092d0 commit b0afa0f

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4286,6 +4286,13 @@
42864286
only normal grace-period primitives. No effect
42874287
on CONFIG_TINY_RCU kernels.
42884288

4289+
rcupdate.rcu_task_ipi_delay= [KNL]
4290+
Set time in jiffies during which RCU tasks will
4291+
avoid sending IPIs, starting with the beginning
4292+
of a given grace period. Setting a large
4293+
number avoids disturbing real-time workloads,
4294+
but lengthens grace periods.
4295+
42894296
rcupdate.rcu_task_stall_timeout= [KNL]
42904297
Set timeout in jiffies for RCU task stall warning
42914298
messages. Disable with a value less than or equal

kernel/rcu/tasks.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ static struct rcu_tasks rt_name = \
7474
/* Track exiting tasks in order to allow them to be waited for. */
7575
DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);
7676

77+
/* Avoid IPIing CPUs early in the grace period. */
78+
#define RCU_TASK_IPI_DELAY (HZ / 2)
79+
static int rcu_task_ipi_delay __read_mostly = RCU_TASK_IPI_DELAY;
80+
module_param(rcu_task_ipi_delay, int, 0644);
81+
7782
/* Control stall timeouts. Disable with <= 0, otherwise jiffies till stall. */
7883
#define RCU_TASK_STALL_TIMEOUT (HZ * 60 * 10)
7984
static int rcu_task_stall_timeout __read_mostly = RCU_TASK_STALL_TIMEOUT;
@@ -713,6 +718,10 @@ DECLARE_WAIT_QUEUE_HEAD(trc_wait); // List of holdout tasks.
713718
// Record outstanding IPIs to each CPU. No point in sending two...
714719
static DEFINE_PER_CPU(bool, trc_ipi_to_cpu);
715720

721+
void call_rcu_tasks_trace(struct rcu_head *rhp, rcu_callback_t func);
722+
DEFINE_RCU_TASKS(rcu_tasks_trace, rcu_tasks_wait_gp, call_rcu_tasks_trace,
723+
"RCU Tasks Trace");
724+
716725
/* If we are the last reader, wake up the grace-period kthread. */
717726
void rcu_read_unlock_trace_special(struct task_struct *t)
718727
{
@@ -998,10 +1007,6 @@ void exit_tasks_rcu_finish_trace(struct task_struct *t)
9981007
rcu_read_unlock_trace_special(t);
9991008
}
10001009

1001-
void call_rcu_tasks_trace(struct rcu_head *rhp, rcu_callback_t func);
1002-
DEFINE_RCU_TASKS(rcu_tasks_trace, rcu_tasks_wait_gp, call_rcu_tasks_trace,
1003-
"RCU Tasks Trace");
1004-
10051010
/**
10061011
* call_rcu_tasks_trace() - Queue a callback trace task-based grace period
10071012
* @rhp: structure to be used for queueing the RCU updates.

0 commit comments

Comments
 (0)