aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcu/tree.c
diff options
context:
space:
mode:
authorByungchul Park <byungchul.park@lge.com>2018-05-31 22:03:09 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2018-07-12 18:39:22 -0400
commit67abb96cbf307e16e3c6d1a0328ece085b5ce94c (patch)
treecf725675a2ccd119245cf818fb01f634cf90fcc8 /kernel/rcu/tree.c
parent47199a0812535217c29933cecf468568bb37f933 (diff)
rcu: Check the range of jiffies_till_{first,next}_fqs when setting them
Currently, the range of jiffies_till_{first,next}_fqs are checked and adjusted on and on in the loop of rcu_gp_kthread on runtime. However, it's enough to check them only when setting them, not every time in the loop. So make them handled on a setting time via sysfs. Signed-off-by: Byungchul Park <byungchul.park@lge.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcu/tree.c')
-rw-r--r--kernel/rcu/tree.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 4915525559ac..7498a416f63b 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -510,8 +510,38 @@ static ulong jiffies_till_first_fqs = ULONG_MAX;
510static ulong jiffies_till_next_fqs = ULONG_MAX; 510static ulong jiffies_till_next_fqs = ULONG_MAX;
511static bool rcu_kick_kthreads; 511static bool rcu_kick_kthreads;
512 512
513module_param(jiffies_till_first_fqs, ulong, 0644); 513static int param_set_first_fqs_jiffies(const char *val, const struct kernel_param *kp)
514module_param(jiffies_till_next_fqs, ulong, 0644); 514{
515 ulong j;
516 int ret = kstrtoul(val, 0, &j);
517
518 if (!ret)
519 WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : j);
520 return ret;
521}
522
523static int param_set_next_fqs_jiffies(const char *val, const struct kernel_param *kp)
524{
525 ulong j;
526 int ret = kstrtoul(val, 0, &j);
527
528 if (!ret)
529 WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : (j ?: 1));
530 return ret;
531}
532
533static struct kernel_param_ops first_fqs_jiffies_ops = {
534 .set = param_set_first_fqs_jiffies,
535 .get = param_get_ulong,
536};
537
538static struct kernel_param_ops next_fqs_jiffies_ops = {
539 .set = param_set_next_fqs_jiffies,
540 .get = param_get_ulong,
541};
542
543module_param_cb(jiffies_till_first_fqs, &first_fqs_jiffies_ops, &jiffies_till_first_fqs, 0644);
544module_param_cb(jiffies_till_next_fqs, &next_fqs_jiffies_ops, &jiffies_till_next_fqs, 0644);
515module_param(rcu_kick_kthreads, bool, 0644); 545module_param(rcu_kick_kthreads, bool, 0644);
516 546
517/* 547/*
@@ -2180,10 +2210,6 @@ static int __noreturn rcu_gp_kthread(void *arg)
2180 /* Handle quiescent-state forcing. */ 2210 /* Handle quiescent-state forcing. */
2181 first_gp_fqs = true; 2211 first_gp_fqs = true;
2182 j = jiffies_till_first_fqs; 2212 j = jiffies_till_first_fqs;
2183 if (j > HZ) {
2184 j = HZ;
2185 jiffies_till_first_fqs = HZ;
2186 }
2187 ret = 0; 2213 ret = 0;
2188 for (;;) { 2214 for (;;) {
2189 if (!ret) { 2215 if (!ret) {
@@ -2218,13 +2244,6 @@ static int __noreturn rcu_gp_kthread(void *arg)
2218 WRITE_ONCE(rsp->gp_activity, jiffies); 2244 WRITE_ONCE(rsp->gp_activity, jiffies);
2219 ret = 0; /* Force full wait till next FQS. */ 2245 ret = 0; /* Force full wait till next FQS. */
2220 j = jiffies_till_next_fqs; 2246 j = jiffies_till_next_fqs;
2221 if (j > HZ) {
2222 j = HZ;
2223 jiffies_till_next_fqs = HZ;
2224 } else if (j < 1) {
2225 j = 1;
2226 jiffies_till_next_fqs = 1;
2227 }
2228 } else { 2247 } else {
2229 /* Deal with stray signal. */ 2248 /* Deal with stray signal. */
2230 cond_resched_tasks_rcu_qs(); 2249 cond_resched_tasks_rcu_qs();