1. 16 5月, 2018 6 次提交
    • P
      rcu: Make rcu_future_needs_gp() check all ->need_future_gps[] elements · 0ae94e00
      Paul E. McKenney 提交于
      Currently, the rcu_future_needs_gp() function checks only the current
      element of the ->need_future_gps[] array, which might miss elements that
      were offset from the expected element, for example, due to races with
      the start or the end of a grace period.  This commit therefore makes
      rcu_future_needs_gp() use the need_any_future_gp() macro to check all
      of the elements of this array.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Tested-by: NNicholas Piggin <npiggin@gmail.com>
      0ae94e00
    • P
      rcu: Make rcu_gp_cleanup() more accurately predict need for new GP · fb31340f
      Paul E. McKenney 提交于
      Currently, rcu_gp_cleanup() scans the rcu_node tree in order to reset
      state to reflect the end of the grace period.  It also checks to see
      whether a new grace period is needed, but in a number of cases, rather
      than directly cause the new grace period to be immediately started, it
      instead leaves the grace-period-needed state where various fail-safes
      can find it.  This works fine, but results in higher contention on the
      root rcu_node structure's ->lock, which is undesirable, and contention
      on that lock has recently become noticeable.
      
      This commit therefore makes rcu_gp_cleanup() immediately start a new
      grace period if there is any need for one.
      
      It is quite possible that it will later be necessary to throttle the
      grace-period rate, but that can be dealt with when and if.
      Reported-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Tested-by: NNicholas Piggin <npiggin@gmail.com>
      fb31340f
    • P
      rcu: Make rcu_gp_kthread() check for early-boot activity · 5fe0a562
      Paul E. McKenney 提交于
      The rcu_gp_kthread() function immediately sleeps waiting to be notified
      of the need for a new grace period, which currently works because there
      are a number of code sequences that will provide the needed wakeup later.
      However, some of these code sequences need to acquire the root rcu_node
      structure's ->lock, and contention on that lock has started manifesting.
      This commit therefore makes rcu_gp_kthread() check for early-boot activity
      when it starts up, omitting the initial sleep in that case.
      Reported-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Tested-by: NNicholas Piggin <npiggin@gmail.com>
      5fe0a562
    • P
      rcu: Add accessor macros for the ->need_future_gp[] array · c91a8675
      Paul E. McKenney 提交于
      Accessors for the ->need_future_gp[] array are currently open-coded,
      which makes them difficult to change.  To improve maintainability, this
      commit adds need_future_gp_mask() to compute the indexing mask from the
      array size, need_future_gp_element() to access the element corresponding
      to the specified grace-period number, and need_any_future_gp() to
      determine if any future grace period is needed.  This commit also applies
      need_future_gp_element() to existing open-coded single-element accesses.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Tested-by: NNicholas Piggin <npiggin@gmail.com>
      c91a8675
    • P
      rcu: Make rcu_start_future_gp()'s grace-period check more precise · 825a9911
      Paul E. McKenney 提交于
      The rcu_start_future_gp() function uses a sloppy check for a grace
      period being in progress, which works today because there are a number
      of code sequences that resolve the resulting races.  However, some of
      these race-resolution code sequences must acquire the root rcu_node
      structure's ->lock, and contention on that lock has started manifesting.
      This commit therefore makes rcu_start_future_gp() check more precise,
      eliminating the sloppy lockless check of the rcu_state structure's ->gpnum
      and ->completed fields.  The effect is that rcu_start_future_gp() will
      sometimes unnecessarily attempt to start a new grace period, but this
      overhead will be reduced later using funnel locking.
      Reported-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Tested-by: NNicholas Piggin <npiggin@gmail.com>
      825a9911
    • P
      rcu: Improve non-root rcu_cbs_completed() accuracy · 9036c2ff
      Paul E. McKenney 提交于
      When rcu_cbs_completed() is invoked on a non-root rcu_node structure,
      it unconditionally assumes that two grace periods must complete before
      the callbacks at hand can be invoked.  This is overly conservative because
      if that non-root rcu_node structure believes that no grace period is in
      progress, and if the corresponding rcu_state structure's ->gpnum field
      has not yet been incremented, then these callbacks may safely be invoked
      after only one grace period has completed.
      
      This change is required to permit grace-period start requests to use
      funnel locking, which is in turn permitted to reduce root rcu_node ->lock
      contention, which has been observed by Nick Piggin.  Furthermore, such
      contention will likely be increased by the merging of RCU-bh, RCU-preempt,
      and RCU-sched, so it makes sense to take steps to decrease it.
      
      This commit therefore improves the accuracy of rcu_cbs_completed() when
      invoked on a non-root rcu_node structure as described above.
      Reported-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Tested-by: NNicholas Piggin <npiggin@gmail.com>
      9036c2ff
  2. 24 2月, 2018 1 次提交
    • P
      rcu: Create RCU-specific workqueues with rescuers · ad7c946b
      Paul E. McKenney 提交于
      RCU's expedited grace periods can participate in out-of-memory deadlocks
      due to all available system_wq kthreads being blocked and there not being
      memory available to create more.  This commit prevents such deadlocks
      by allocating an RCU-specific workqueue_struct at early boot time, and
      providing it with a rescuer to ensure forward progress.  This uses the
      shiny new init_rescuer() function provided by Tejun (but indirectly).
      
      This commit also causes SRCU to use this new RCU-specific
      workqueue_struct.  Note that SRCU's use of workqueues never blocks them
      waiting for readers, so this should be safe from a forward-progress
      viewpoint.  Note that this moves SRCU from system_power_efficient_wq
      to a normal workqueue.  In the unlikely event that this results in
      measurable degradation, a separate power-efficient workqueue will be
      creates for SRCU.
      Reported-by: NPrateek Sood <prsood@codeaurora.org>
      Reported-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      ad7c946b
  3. 21 2月, 2018 5 次提交
  4. 16 2月, 2018 1 次提交
  5. 12 12月, 2017 1 次提交
  6. 29 11月, 2017 8 次提交
  7. 28 11月, 2017 7 次提交
  8. 08 11月, 2017 1 次提交
  9. 20 10月, 2017 2 次提交
  10. 10 10月, 2017 2 次提交
    • P
      rcu: Make RCU CPU stall warnings check for irq-disabled CPUs · 9b9500da
      Paul E. McKenney 提交于
      One common question upon seeing an RCU CPU stall warning is "did
      the stalled CPUs have interrupts disabled?"  However, the current
      stall warnings are silent on this point.  This commit therefore
      uses irq_work to check whether stalled CPUs still respond to IPIs,
      and flags this state in the RCU CPU stall warning console messages.
      Reported-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      9b9500da
    • P
      sched,rcu: Make cond_resched() provide RCU quiescent state · f79c3ad6
      Paul E. McKenney 提交于
      There is some confusion as to which of cond_resched() or
      cond_resched_rcu_qs() should be added to long in-kernel loops.
      This commit therefore eliminates the decision by adding RCU quiescent
      states to cond_resched().  This commit also simplifies the code that
      used to interact with cond_resched_rcu_qs(), and that now interacts with
      cond_resched(), to reduce its overhead.  This reduction is necessary to
      allow the heavier-weight cond_resched_rcu_qs() mechanism to be invoked
      everywhere that cond_resched() is invoked.
      
      Part of that reduction in overhead converts the jiffies_till_sched_qs
      kernel parameter to read-only at runtime, thus eliminating the need for
      bounds checking.
      Reported-by: NMichal Hocko <mhocko@kernel.org>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      [ paulmck: Keep PREEMPT=n cond_resched a no-op, per Peter Zijlstra. ]
      f79c3ad6
  11. 03 10月, 2017 1 次提交
  12. 24 9月, 2017 1 次提交
    • P
      rcu: Allow for page faults in NMI handlers · 28585a83
      Paul E. McKenney 提交于
      A number of architecture invoke rcu_irq_enter() on exception entry in
      order to allow RCU read-side critical sections in the exception handler
      when the exception is from an idle or nohz_full CPU.  This works, at
      least unless the exception happens in an NMI handler.  In that case,
      rcu_nmi_enter() would already have exited the extended quiescent state,
      which would mean that rcu_irq_enter() would (incorrectly) cause RCU
      to think that it is again in an extended quiescent state.  This will
      in turn result in lockdep splats in response to later RCU read-side
      critical sections.
      
      This commit therefore causes rcu_irq_enter() and rcu_irq_exit() to
      take no action if there is an rcu_nmi_enter() in effect, thus avoiding
      the unscheduled return to RCU quiescent state.  This in turn should
      make the kernel safe for on-demand RCU voyeurism.
      
      Link: http://lkml.kernel.org/r/20170922211022.GA18084@linux.vnet.ibm.com
      
      Cc: stable@vger.kernel.org
      Fixes: 0be964be ("module: Sanitize RCU usage and locking")
      Reported-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      28585a83
  13. 09 9月, 2017 1 次提交
  14. 17 8月, 2017 3 次提交