History

rcu-tasks: Make the units of ->init_fract be jiffies

Currently, the units of ->init_fract are milliseconds while those of ->gp_sleep are jiffies. For consistency with each other and with the argument of schedule_timeout_idle(), this commit changes the units of ->init_fract to jiffies. This change does affect the backoff algorithm, but only on systems where HZ is not 1000, and even there the change makes more sense, given that the current setup would "back off" to the same number of jiffies repeatedly. In contrast, with this change, the number of jiffies waited increases on each pass through the loop in the rcu_tasks_wait_gp() function.

Paul E. McKenney committed 6 years ago

Commit 75dc2da1 parent 27c0f141 file · +6 −8Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/rcu/tasks.h+6−8
@@ -335,8 +335,6 @@ static void rcu_tasks_wait_gp(struct rcu_tasks *rtp) · 334 unmodified lines
335335
336336 // Start off with initial wait and slowly back off to 1 HZ wait.
337337 fract = rtp->init_fract;
338− if (fract > HZ)
339− fract = HZ;
340338
341339 while (!list_empty(&holdouts)) {
342340 bool firstreport;
@@ -345,10 +343,10 @@ static void rcu_tasks_wait_gp(struct rcu_tasks *rtp) · 2 unmodified lines
345343
346344 /* Slowly back off waiting for holdouts */
347345 set_tasks_gp_state(rtp, RTGS_WAIT_SCAN_HOLDOUTS);
348− schedule_timeout_idle(HZ/fract);
346+ schedule_timeout_idle(fract);
349347
350− if (fract > 1)
351− fract--;
348+ if (fract < HZ)
349+ fract++;
352350
353351 rtst = READ_ONCE(rcu_task_stall_timeout);
354352 needreport = rtst > 0 && time_after(jiffies, lastreport + rtst);
@@ -557,7 +555,7 @@ EXPORT_SYMBOL_GPL(rcu_barrier_tasks); · 202 unmodified lines
557555 static int __init rcu_spawn_tasks_kthread(void)
558556 {
559557 rcu_tasks.gp_sleep = HZ / 10;
560− rcu_tasks.init_fract = 10;
558+ rcu_tasks.init_fract = HZ / 10;
561559 rcu_tasks.pregp_func = rcu_tasks_pregp_step;
562560 rcu_tasks.pertask_func = rcu_tasks_pertask;
563561 rcu_tasks.postscan_func = rcu_tasks_postscan;
@@ -1178,12 +1176,12 @@ static int __init rcu_spawn_tasks_trace_kthread(void) · 614 unmodified lines
11781176 {
11791177 if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB)) {
11801178 rcu_tasks_trace.gp_sleep = HZ / 10;
1181− rcu_tasks_trace.init_fract = 10;
1179+ rcu_tasks_trace.init_fract = HZ / 10;
11821180 } else {
11831181 rcu_tasks_trace.gp_sleep = HZ / 200;
11841182 if (rcu_tasks_trace.gp_sleep <= 0)
11851183 rcu_tasks_trace.gp_sleep = 1;
1186− rcu_tasks_trace.init_fract = HZ / 5;
1184+ rcu_tasks_trace.init_fract = HZ / 200;
11871185 if (rcu_tasks_trace.init_fract <= 0)
11881186 rcu_tasks_trace.init_fract = 1;
11891187 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t