]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
rcu: Make RCU_FAST_NO_HZ handle adaptive ticks
authorPaul E. McKenney <paul.mckenney@linaro.org>
Thu, 28 Jun 2012 19:33:51 +0000 (12:33 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 31 Jul 2012 17:32:39 +0000 (10:32 -0700)
The current implementation of RCU_FAST_NO_HZ tries reasonably hard to rid
the current CPU of RCU callbacks.  This is appropriate when the CPU is
entering idle, where it doesn't have much useful to do anyway, but is most
definitely not what you want when transitioning to user-mode execution.
This commit therefore detects the adaptive-tick case, and refrains from
burning CPU time getting rid of RCU callbacks in that case.

Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
kernel/rcutree_plugin.h

index 7f3244c0df014a7673831159ae1dbc25ceff55c8..b0f09d629a5466b499f7d426428f9cd23f278112 100644 (file)
@@ -1997,6 +1997,26 @@ static void rcu_prepare_for_idle(int cpu)
        if (!tne)
                return;
 
+       /* Adaptive-tick mode, where usermode execution is idle to RCU. */
+       if (!is_idle_task(current)) {
+               rdtp->dyntick_holdoff = jiffies - 1;
+               if (rcu_cpu_has_nonlazy_callbacks(cpu)) {
+                       trace_rcu_prep_idle("User dyntick with callbacks");
+                       rdtp->idle_gp_timer_expires =
+                               round_up(jiffies + RCU_IDLE_GP_DELAY,
+                                        RCU_IDLE_GP_DELAY);
+               } else if (rcu_cpu_has_callbacks(cpu)) {
+                       rdtp->idle_gp_timer_expires =
+                               round_jiffies(jiffies + RCU_IDLE_LAZY_GP_DELAY);
+                       trace_rcu_prep_idle("User dyntick with lazy callbacks");
+               } else {
+                       return;
+               }
+               tp = &rdtp->idle_gp_timer;
+               mod_timer_pinned(tp, rdtp->idle_gp_timer_expires);
+               return;
+       }
+
        /*
         * If this is an idle re-entry, for example, due to use of
         * RCU_NONIDLE() or the new idle-loop tracing API within the idle