]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
rcutorture: Emulate dyntick aspect of userspace nohz_full sojourn
authorPaul E. McKenney <paulmck@kernel.org>
Sun, 4 Aug 2019 20:17:35 +0000 (13:17 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Sat, 5 Oct 2019 17:46:05 +0000 (10:46 -0700)
During an actual call_rcu() flood, there would be frequent trips to
userspace (in-kernel call_rcu() floods must be otherwise housebroken).
Userspace execution on nohz_full CPUs implies an RCU dyntick idle/not-idle
transition pair, so this commit adds emulation of that pair.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
include/linux/rcutiny.h
kernel/rcu/rcutorture.c
kernel/rcu/tree.c

index 9bf1dfe7781f3aac603844d9ce29c20f74a36b29..37b6f0c2b79d95422acc33f255ea09c635c3862b 100644 (file)
@@ -84,6 +84,7 @@ static inline void rcu_scheduler_starting(void) { }
 #endif /* #else #ifndef CONFIG_SRCU */
 static inline void rcu_end_inkernel_boot(void) { }
 static inline bool rcu_is_watching(void) { return true; }
+static inline void rcu_momentary_dyntick_idle(void) { }
 
 /* Avoid RCU read-side critical sections leaking across. */
 static inline void rcu_all_qs(void) { barrier(); }
index ab61f5c1353bfa2d4a7b83d65042c51046d54853..49ad88765ed2307f741df3b7625776d55966afb5 100644 (file)
@@ -1761,6 +1761,11 @@ static unsigned long rcu_torture_fwd_prog_cbfree(void)
                kfree(rfcp);
                freed++;
                rcu_torture_fwd_prog_cond_resched(freed);
+               if (tick_nohz_full_enabled()) {
+                       local_irq_save(flags);
+                       rcu_momentary_dyntick_idle();
+                       local_irq_restore(flags);
+               }
        }
        return freed;
 }
@@ -1835,6 +1840,7 @@ static void rcu_torture_fwd_prog_nr(int *tested, int *tested_tries)
 static void rcu_torture_fwd_prog_cr(void)
 {
        unsigned long cver;
+       unsigned long flags;
        unsigned long gps;
        int i;
        long n_launders;
@@ -1894,6 +1900,11 @@ static void rcu_torture_fwd_prog_cr(void)
                }
                cur_ops->call(&rfcp->rh, rcu_torture_fwd_cb_cr);
                rcu_torture_fwd_prog_cond_resched(n_launders + n_max_cbs);
+               if (tick_nohz_full_enabled()) {
+                       local_irq_save(flags);
+                       rcu_momentary_dyntick_idle();
+                       local_irq_restore(flags);
+               }
        }
        stoppedat = jiffies;
        n_launders_cb_snap = READ_ONCE(n_launders_cb);
index 7c67ea561b36744b3fc292cd6fa4ca689134c163..66354ef776aa8b2da0c6c452a357dfbb97773f11 100644 (file)
@@ -375,6 +375,7 @@ void rcu_momentary_dyntick_idle(void)
        WARN_ON_ONCE(!(special & RCU_DYNTICK_CTRL_CTR));
        rcu_preempt_deferred_qs(current);
 }
+EXPORT_SYMBOL_GPL(rcu_momentary_dyntick_idle);
 
 /**
  * rcu_is_cpu_rrupt_from_idle - see if interrupted from idle