@@ -14,6 +14,9 @@ extern unsigned long sysctl_hung_task_timeout_secs;
enum { sysctl_hung_task_timeout_secs = 0 };
#endif
+extern unsigned int sysctl_rcu_lazy;
+extern unsigned int sysctl_rcu_lazy_jiffies;
+
enum sched_tunable_scaling {
SCHED_TUNABLESCALING_NONE,
SCHED_TUNABLESCALING_LOG,
@@ -266,6 +266,9 @@ static bool wake_nocb_gp(struct rcu_data *rdp, bool force)
#define LAZY_FLUSH_JIFFIES (10 * HZ)
unsigned long jiffies_till_flush = LAZY_FLUSH_JIFFIES;
+unsigned int sysctl_rcu_lazy_jiffies = LAZY_FLUSH_JIFFIES;
+unsigned int sysctl_rcu_lazy = 1;
+
#ifdef CONFIG_RCU_LAZY
// To be called only from test code.
void rcu_lazy_set_jiffies_till_flush(unsigned long jif)
@@ -292,6 +295,9 @@ static void wake_nocb_gp_defer(struct rcu_data *rdp, int waketype,
struct rcu_data *rdp_gp = rdp->nocb_gp_rdp;
unsigned long mod_jif = 0;
+ /* debug: not for merge */
+ rcu_lazy_set_jiffies_till_flush(sysctl_rcu_lazy_jiffies);
+
raw_spin_lock_irqsave(&rdp_gp->nocb_gp_lock, flags);
/*
@@ -697,6 +703,9 @@ static void nocb_gp_wait(struct rcu_data *my_rdp)
unsigned long wait_gp_seq = 0; // Suppress "use uninitialized" warning.
bool wasempty = false;
+ /* debug: not for merge */
+ rcu_lazy_set_jiffies_till_flush(sysctl_rcu_lazy_jiffies);
+
/*
* Each pass through the following loop checks for CBs and for the
* nearest grace period (if any) to wait for next. The CB kthreads
@@ -2450,6 +2450,23 @@ static struct ctl_table vm_table[] = {
.extra2 = SYSCTL_ONE,
},
#endif
+#ifdef CONFIG_RCU_LAZY
+ {
+ .procname = "rcu_lazy",
+ .data = &sysctl_rcu_lazy,
+ .maxlen = sizeof(unsigned int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
+ {
+ .procname = "rcu_lazy_jiffies",
+ .data = &sysctl_rcu_lazy_jiffies,
+ .maxlen = sizeof(unsigned int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
+#endif
+
{ }
};
Enable/Disable this feature by writing 1 or 0 /proc/sys/vm/rcu_lazy. Change value of /proc/sys/vm/rcu_lazy_jiffies to change max duration before flush. Do not merge, only for debug for reviewers. Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org> --- include/linux/sched/sysctl.h | 3 +++ kernel/rcu/tree_nocb.h | 9 +++++++++ kernel/sysctl.c | 17 +++++++++++++++++ 3 files changed, 29 insertions(+)