1. 21 9月, 2015 2 次提交
  2. 23 7月, 2015 3 次提交
  3. 18 7月, 2015 5 次提交
  4. 16 7月, 2015 1 次提交
  5. 19 6月, 2015 1 次提交
    • T
      timer: Reduce timer migration overhead if disabled · bc7a34b8
      Thomas Gleixner 提交于
      Eric reported that the timer_migration sysctl is not really nice
      performance wise as it needs to check at every timer insertion whether
      the feature is enabled or not. Further the check does not live in the
      timer code, so we have an extra function call which checks an extra
      cache line to figure out that it is disabled.
      
      We can do better and store that information in the per cpu (hr)timer
      bases. I pondered to use a static key, but that's a nightmare to
      update from the nohz code and the timer base cache line is hot anyway
      when we select a timer base.
      
      The old logic enabled the timer migration unconditionally if
      CONFIG_NO_HZ was set even if nohz was disabled on the kernel command
      line.
      
      With this modification, we start off with migration disabled. The user
      visible sysctl is still set to enabled. If the kernel switches to NOHZ
      migration is enabled, if the user did not disable it via the sysctl
      prior to the switch. If nohz=off is on the kernel command line,
      migration stays disabled no matter what.
      
      Before:
        47.76%  hog       [.] main
        14.84%  [kernel]  [k] _raw_spin_lock_irqsave
         9.55%  [kernel]  [k] _raw_spin_unlock_irqrestore
         6.71%  [kernel]  [k] mod_timer
         6.24%  [kernel]  [k] lock_timer_base.isra.38
         3.76%  [kernel]  [k] detach_if_pending
         3.71%  [kernel]  [k] del_timer
         2.50%  [kernel]  [k] internal_add_timer
         1.51%  [kernel]  [k] get_nohz_timer_target
         1.28%  [kernel]  [k] __internal_add_timer
         0.78%  [kernel]  [k] timerfn
         0.48%  [kernel]  [k] wake_up_nohz_cpu
      
      After:
        48.10%  hog       [.] main
        15.25%  [kernel]  [k] _raw_spin_lock_irqsave
         9.76%  [kernel]  [k] _raw_spin_unlock_irqrestore
         6.50%  [kernel]  [k] mod_timer
         6.44%  [kernel]  [k] lock_timer_base.isra.38
         3.87%  [kernel]  [k] detach_if_pending
         3.80%  [kernel]  [k] del_timer
         2.67%  [kernel]  [k] internal_add_timer
         1.33%  [kernel]  [k] __internal_add_timer
         0.73%  [kernel]  [k] timerfn
         0.54%  [kernel]  [k] wake_up_nohz_cpu
      Reported-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Joonwoo Park <joonwoop@codeaurora.org>
      Cc: Wenbo Wang <wenbo.wang@memblaze.com>
      Link: http://lkml.kernel.org/r/20150526224512.127050787@linutronix.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      bc7a34b8
  6. 28 5月, 2015 12 次提交
  7. 22 4月, 2015 1 次提交
  8. 13 3月, 2015 3 次提交
    • P
      rcu: Process offlining and onlining only at grace-period start · 0aa04b05
      Paul E. McKenney 提交于
      Races between CPU hotplug and grace periods can be difficult to resolve,
      so the ->onoff_mutex is used to exclude the two events.  Unfortunately,
      this means that it is impossible for an outgoing CPU to perform the
      last bits of its offlining from its last pass through the idle loop,
      because sleeplocks cannot be acquired in that context.
      
      This commit avoids these problems by buffering online and offline events
      in a new ->qsmaskinitnext field in the leaf rcu_node structures.  When a
      grace period starts, the events accumulated in this mask are applied to
      the ->qsmaskinit field, and, if needed, up the rcu_node tree.  The special
      case of all CPUs corresponding to a given leaf rcu_node structure being
      offline while there are still elements in that structure's ->blkd_tasks
      list is handled using a new ->wait_blkd_tasks field.  In this case,
      propagating the offline bits up the tree is deferred until the beginning
      of the grace period after all of the tasks have exited their RCU read-side
      critical sections and removed themselves from the list, at which point
      the ->wait_blkd_tasks flag is cleared.  If one of that leaf rcu_node
      structure's CPUs comes back online before the list empties, then the
      ->wait_blkd_tasks flag is simply cleared.
      
      This of course means that RCU's notion of which CPUs are offline can be
      out of date.  This is OK because RCU need only wait on CPUs that were
      online at the time that the grace period started.  In addition, RCU's
      force-quiescent-state actions will handle the case where a CPU goes
      offline after the grace period starts.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      0aa04b05
    • P
      rcu: Move rcu_report_unblock_qs_rnp() to common code · cc99a310
      Paul E. McKenney 提交于
      The rcu_report_unblock_qs_rnp() function is invoked when the
      last task blocking the current grace period exits its outermost
      RCU read-side critical section.  Previously, this was called only
      from rcu_read_unlock_special(), and was therefore defined only when
      CONFIG_RCU_PREEMPT=y.  However, this function will be invoked even when
      CONFIG_RCU_PREEMPT=n once CPU-hotplug operations are processed only at
      the beginnings of RCU grace periods.  The reason for this change is that
      the last task on a given leaf rcu_node structure's ->blkd_tasks list
      might well exit its RCU read-side critical section between the time that
      recent CPU-hotplug operations were applied and when the new grace period
      was initialized.  This situation could result in RCU waiting forever on
      that leaf rcu_node structure, because if all that structure's CPUs were
      already offline, there would be no quiescent-state events to drive that
      structure's part of the grace period.
      
      This commit therefore moves rcu_report_unblock_qs_rnp() to common code
      that is built unconditionally so that the quiescent-state-forcing code
      can clean up after this situation, avoiding the grace-period stall.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      cc99a310
    • P
      rcu: Rework preemptible expedited bitmask handling · 8eb74b2b
      Paul E. McKenney 提交于
      Currently, the rcu_node tree ->expmask bitmasks are initially set to
      reflect the online CPUs.  This is pointless, because only the CPUs
      preempted within RCU read-side critical sections by the preceding
      synchronize_sched_expedited() need to be tracked.  This commit therefore
      instead sets up these bitmasks based on the state of the ->blkd_tasks
      lists.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      8eb74b2b
  9. 12 3月, 2015 2 次提交
  10. 04 3月, 2015 4 次提交
  11. 27 2月, 2015 3 次提交
  12. 14 2月, 2015 1 次提交
  13. 12 2月, 2015 1 次提交
    • P
      rcu: Clear need_qs flag to prevent splat · c0135d07
      Paul E. McKenney 提交于
      If the scheduling-clock interrupt sets the current tasks need_qs flag,
      but if the current CPU passes through a quiescent state in the meantime,
      then rcu_preempt_qs() will fail to clear the need_qs flag, which can fool
      RCU into thinking that additional rcu_read_unlock_special() processing
      is needed.  This commit therefore clears the need_qs flag before checking
      for additional processing.
      
      For this problem to occur, we need rcu_preempt_data.passed_quiesce equal
      to true and current->rcu_read_unlock_special.b.need_qs also equal to true.
      This condition can occur as follows:
      
      1.	CPU 0 is aware of the current preemptible RCU grace period,
      	but has not yet passed through a quiescent state.  Among other
      	things, this means that rcu_preempt_data.passed_quiesce is false.
      
      2.	Task A running on CPU 0 enters a preemptible RCU read-side
      	critical section.
      
      3.	CPU 0 takes a scheduling-clock interrupt, which notices the
      	RCU read-side critical section and the need for a quiescent state,
      	and thus sets current->rcu_read_unlock_special.b.need_qs to true.
      
      4.	Task A is preempted, enters the scheduler, eventually invoking
      	rcu_preempt_note_context_switch() which in turn invokes
      	rcu_preempt_qs().
      
      	Because rcu_preempt_data.passed_quiesce is false,
      	control enters the body of the "if" statement, which sets
      	rcu_preempt_data.passed_quiesce to true.
      
      5.	At this point, CPU 0 takes an interrupt.  The interrupt
      	handler contains an RCU read-side critical section, and
      	the rcu_read_unlock() notes that current->rcu_read_unlock_special
      	is nonzero, and thus invokes rcu_read_unlock_special().
      
      6.	Once in rcu_read_unlock_special(), the fact that
      	current->rcu_read_unlock_special.b.need_qs is true becomes
      	apparent, so rcu_read_unlock_special() invokes rcu_preempt_qs().
      	Recursively, given that we interrupted out of that same
      	function in the preceding step.
      
      7.	Because rcu_preempt_data.passed_quiesce is now true,
      	rcu_preempt_qs() does nothing, and simply returns.
      
      8.	Upon return to rcu_read_unlock_special(), it is noted that
      	current->rcu_read_unlock_special is still nonzero (because
      	the interrupted rcu_preempt_qs() had not yet gotten around
      	to clearing current->rcu_read_unlock_special.b.need_qs).
      
      9.	Execution proceeds to the WARN_ON_ONCE(), which notes that
      	we are in an interrupt handler and thus duly splats.
      
      The solution, as noted above, is to make rcu_read_unlock_special()
      clear out current->rcu_read_unlock_special.b.need_qs after calling
      rcu_preempt_qs().  The interrupted rcu_preempt_qs() will clear it again,
      but this is harmless.  The worst that happens is that we clobber another
      attempt to set this field, but this is not a problem because we just
      got done reporting a quiescent state.
      Reported-by: NSasha Levin <sasha.levin@oracle.com>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      [ paulmck: Fix embarrassing build bug noted by Sasha Levin. ]
      Tested-by: NSasha Levin <sasha.levin@oracle.com>
      c0135d07
  14. 16 1月, 2015 1 次提交
    • P
      rcu: Optionally run grace-period kthreads at real-time priority · a94844b2
      Paul E. McKenney 提交于
      Recent testing has shown that under heavy load, running RCU's grace-period
      kthreads at real-time priority can improve performance (according to 0day
      test robot) and reduce the incidence of RCU CPU stall warnings.  However,
      most systems do just fine with the default non-realtime priorities for
      these kthreads, and it does not make sense to expose the entire user
      base to any risk stemming from this change, given that this change is
      of use only to a few users running extremely heavy workloads.
      
      Therefore, this commit allows users to specify realtime priorities
      for the grace-period kthreads, but leaves them running SCHED_OTHER
      by default.  The realtime priority may be specified at build time
      via the RCU_KTHREAD_PRIO Kconfig parameter, or at boot time via the
      rcutree.kthread_prio parameter.  Either way, 0 says to continue the
      default SCHED_OTHER behavior and values from 1-99 specify that priority
      of SCHED_FIFO behavior.  Note that a value of 0 is not permitted when
      the RCU_BOOST Kconfig parameter is specified.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      a94844b2