提交 fcfd0a23 编写于 作者: P Paul E. McKenney

rcu: Make FQS schedule advance only if FQS happened

Currently, the force-quiescent-state (FQS) code in rcu_gp_kthread() can
advance the next FQS even if one was not executed last time.  This can
happen due timeout-duration uncertainty.  This commit therefore avoids
advancing the FQS schedule unless an FQS was just executed.  In the
corner case where an FQS was not executed, but is due now, the code does
a one-jiffy wait.

This change prepares for kthread kicking.
Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
上级 86057b80
...@@ -2146,6 +2146,15 @@ static int __noreturn rcu_gp_kthread(void *arg) ...@@ -2146,6 +2146,15 @@ static int __noreturn rcu_gp_kthread(void *arg)
TPS("fqsend")); TPS("fqsend"));
cond_resched_rcu_qs(); cond_resched_rcu_qs();
WRITE_ONCE(rsp->gp_activity, jiffies); WRITE_ONCE(rsp->gp_activity, jiffies);
ret = 0; /* Force full wait till next FQS. */
j = jiffies_till_next_fqs;
if (j > HZ) {
j = HZ;
jiffies_till_next_fqs = HZ;
} else if (j < 1) {
j = 1;
jiffies_till_next_fqs = 1;
}
} else { } else {
/* Deal with stray signal. */ /* Deal with stray signal. */
cond_resched_rcu_qs(); cond_resched_rcu_qs();
...@@ -2154,14 +2163,12 @@ static int __noreturn rcu_gp_kthread(void *arg) ...@@ -2154,14 +2163,12 @@ static int __noreturn rcu_gp_kthread(void *arg)
trace_rcu_grace_period(rsp->name, trace_rcu_grace_period(rsp->name,
READ_ONCE(rsp->gpnum), READ_ONCE(rsp->gpnum),
TPS("fqswaitsig")); TPS("fqswaitsig"));
} ret = 1; /* Keep old FQS timing. */
j = jiffies_till_next_fqs; j = jiffies;
if (j > HZ) { if (time_after(jiffies, rsp->jiffies_force_qs))
j = HZ; j = 1;
jiffies_till_next_fqs = HZ; else
} else if (j < 1) { j = rsp->jiffies_force_qs - j;
j = 1;
jiffies_till_next_fqs = 1;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册