21 Aug, 2010

2 commits

  • When using a kernel debugger, a long sojourn in the debugger can get
    you lots of RCU CPU stall warnings once you resume. This might not be
    helpful, especially if you are using the system console. This patch
    therefore allows RCU CPU stall warnings to be suppressed, but only for
    the duration of the current set of grace periods.

    This differs from Jason's original patch in that it adds support for
    tiny RCU and preemptible RCU, and uses a slightly different method for
    suppressing the RCU CPU stall warning messages.

    Signed-off-by: Jason Wessel
    Signed-off-by: Paul E. McKenney
    Tested-by: Jason Wessel

    Paul E. McKenney
     
  • There is some documentation on RCU CPU stall warnings contained in
    Documentation/RCU/stallwarn.txt, but it will not be apparent to someone
    who runs into such a warning while under time pressure. This commit
    therefore adds comments preceding the printk()s pointing out the
    location of this documentation.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     

20 Aug, 2010

4 commits

  • Currently, if RCU CPU stall warnings are enabled, they are enabled
    immediately upon boot. They can be manually disabled via /sys (and
    also re-enabled via /sys), and are automatically disabled upon panic.
    However, some users need RCU CPU stalls to be disabled at boot time,
    but to be enabled without rebuilding/rebooting. For example, someone
    running a real-time application in production might not want the
    additional latency of RCU CPU stall detection in normal operation, but
    might need to enable it at any point for fault isolation purposes.

    This commit therefore provides a new CONFIG_RCU_CPU_STALL_DETECTOR_RUNNABLE
    kernel configuration parameter that maintains the current behavior
    (enable at boot) by default, but allows a kernel to be configured
    with RCU CPU stall detection built into the kernel, but disabled at
    boot time.

    Requested-by: Clark Williams
    Requested-by: John Kacur
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • Set the permissions of the rcu_cpu_stall_suppress to 644 to enable RCU
    CPU stall warnings to be enabled and disabled at runtime via sysfs.

    Suggested-by: Josh Triplett
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • Although the RCU CPU stall warning messages are a very good way to alert
    people to a problem, once alerted, it is sometimes helpful to shut them
    off in order to avoid obscuring other messages that might be being used
    to track down the problem. Although you can rebuild the kernel with
    CONFIG_RCU_CPU_STALL_DETECTOR=n, this is sometimes inconvenient. This
    commit therefore adds a boot parameter named "rcu_cpu_stall_suppress"
    that shuts these messages off without requiring a rebuild (though a
    reboot might be needed for those not brave enough to patch their kernel
    while it is running).

    This message-suppression was already in place for the panic case, so this
    commit need only rename the variable and export it via module_param().

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • &percpu_data is compatible with allocated percpu data.

    And we use it and remove the "->rda[NR_CPUS]" array, saving significant
    storage on systems with large numbers of CPUs. This does add an additional
    level of indirection and thus an additional cache line referenced, but
    because ->rda is not used on the read side, this is OK.

    Signed-off-by: Lai Jiangshan
    Reviewed-by: Tejun Heo
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Josh Triplett

    Lai Jiangshan
     

15 Jun, 2010

1 commit

  • Helps finding racy users of call_rcu(), which results in hangs because list
    entries are overwritten and/or skipped.

    Changelog since v4:
    - Bissectability is now OK
    - Now generate a WARN_ON_ONCE() for non-initialized rcu_head passed to
    call_rcu(). Statically initialized objects are detected with
    object_is_static().
    - Rename rcu_head_init_on_stack to init_rcu_head_on_stack.
    - Remove init_rcu_head() completely.

    Changelog since v3:
    - Include comments from Lai Jiangshan

    This new patch version is based on the debugobjects with the newly introduced
    "active state" tracker.

    Non-initialized entries are all considered as "statically initialized". An
    activation fixup (triggered by call_rcu()) takes care of performing the debug
    object initialization without issuing any warning. Since we cannot increase the
    size of struct rcu_head, I don't see much room to put an identifier for
    statically initialized rcu_head structures. So for now, we have to live without
    "activation without explicit init" detection. But the main purpose of this debug
    option is to detect double-activations (double call_rcu() use of a rcu_head
    before the callback is executed), which is correctly addressed here.

    This also detects potential internal RCU callback corruption, which would cause
    the callbacks to be executed twice.

    Signed-off-by: Mathieu Desnoyers
    CC: David S. Miller
    CC: "Paul E. McKenney"
    CC: akpm@linux-foundation.org
    CC: mingo@elte.hu
    CC: laijs@cn.fujitsu.com
    CC: dipankar@in.ibm.com
    CC: josh@joshtriplett.org
    CC: dvhltc@us.ibm.com
    CC: niv@us.ibm.com
    CC: tglx@linutronix.de
    CC: peterz@infradead.org
    CC: rostedt@goodmis.org
    CC: Valdis.Kletnieks@vt.edu
    CC: dhowells@redhat.com
    CC: eric.dumazet@gmail.com
    CC: Alexey Dobriyan
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Lai Jiangshan

    Mathieu Desnoyers
     

12 May, 2010

1 commit


11 May, 2010

10 commits

  • Lai Jiangshan noted that up to 10% of the RCU_SOFTIRQ are spurious, and
    traced this down to the fact that the current grace-period machinery
    will uselessly raise RCU_SOFTIRQ when a given CPU needs to go through
    a quiescent state, but has not yet done so. In this situation, there
    might well be nothing that RCU_SOFTIRQ can do, and the overhead can be
    worth worrying about in the ksoftirqd case. This patch therefore avoids
    raising RCU_SOFTIRQ in this situation.

    Changes since v1 (http://lkml.org/lkml/2010/3/30/122 from Lai Jiangshan):

    o Omit the rcu_qs_pending() prechecks, as they aren't that
    much less expensive than the quiescent-state checks.

    o Merge with the set_need_resched() patch that reduces IPIs.

    o Add the new n_rp_report_qs field to the rcu_pending tracing output.

    o Update the tracing documentation accordingly.

    Signed-off-by: Lai Jiangshan
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • TREE_RCU assumes that CPU numbering is contiguous, but some users need
    large holes in the numbering to better map to hardware layout. This patch
    makes TREE_RCU (and TREE_PREEMPT_RCU) tolerate large holes in the CPU
    numbering. However, NR_CPUS must still be greater than the largest
    CPU number.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • The existing RCU CPU stall-warning messages can be confusing, especially
    in the case where one CPU detects a single other stalled CPU. In addition,
    the console messages did not say which flavor of RCU detected the stall,
    which can make it difficult to work out exactly what is causing the stall.
    This commit improves these messages.

    Requested-by: Dhaval Giani
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • Print boot-time messages if tracing is enabled, if fanout is set
    to non-default values, if exact fanout is specified, if accelerated
    dyntick-idle grace periods have been enabled, if RCU-lockdep is enabled,
    if rcutorture has been boot-time enabled, if the CPU stall detector has
    been disabled, or if four-level hierarchy has been enabled.

    This is all for TREE_RCU and TREE_PREEMPT_RCU. TINY_RCU will be handled
    separately, if at all.

    Suggested-by: Josh Triplett
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • The current RCU CPU stall warnings remain enabled even after a panic
    occurs, which some people have found to be a bit counterproductive.
    This patch therefore uses a notifier to disable stall warnings once a
    panic occurs.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • TINY_RCU does not need rcu_scheduler_active unless CONFIG_DEBUG_LOCK_ALLOC.
    So conditionally compile rcu_scheduler_active in order to slim down
    rcutiny a bit more. Also gets rid of an EXPORT_SYMBOL_GPL, which is
    responsible for most of the slimming.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • The addition of preemptible RCU to treercu resulted in a bit of
    confusion and inefficiency surrounding the handling of context switches
    for RCU-sched and for RCU-preempt. For RCU-sched, a context switch
    is a quiescent state, pure and simple, just like it always has been.
    For RCU-preempt, a context switch is in no way a quiescent state, but
    special handling is required when a task blocks in an RCU read-side
    critical section.

    However, the callout from the scheduler and the outer loop in ksoftirqd
    still calls something named rcu_sched_qs(), whose name is no longer
    accurate. Furthermore, when rcu_check_callbacks() notes an RCU-sched
    quiescent state, it ends up unnecessarily (though harmlessly, aside
    from the performance hit) enqueuing the current task if it happens to
    be running in an RCU-preempt read-side critical section. This not only
    increases the maximum latency of scheduler_tick(), it also needlessly
    increases the overhead of the next outermost rcu_read_unlock() invocation.

    This patch addresses this situation by separating the notion of RCU's
    context-switch handling from that of RCU-sched's quiescent states.
    The context-switch handling is covered by rcu_note_context_switch() in
    general and by rcu_preempt_note_context_switch() for preemptible RCU.
    This permits rcu_sched_qs() to handle quiescent states and only quiescent
    states. It also reduces the maximum latency of scheduler_tick(), though
    probably by much less than a microsecond. Finally, it means that tasks
    within preemptible-RCU read-side critical sections avoid incurring the
    overhead of queuing unless there really is a context switch.

    Suggested-by: Lai Jiangshan
    Acked-by: Lai Jiangshan
    Signed-off-by: Paul E. McKenney
    Cc: Ingo Molnar
    Cc: Peter Zijlstra

    Paul E. McKenney
     
  • Shrink the RCU_INIT_FLAVOR() macro by moving all but the initialization
    of the ->rda[] array to rcu_init_one(). The call to rcu_init_one()
    can then be moved to the end of the RCU_INIT_FLAVOR() macro, which is
    required because rcu_boot_init_percpu_data(), which is now called from
    rcu_init_one(), depends on the initialization of the ->rda[] array.

    Signed-off-by: Lai Jiangshan
    Signed-off-by: Paul E. McKenney

    Lai Jiangshan
     
  • cleanup: make dead code really dead

    Signed-off-by: Lai Jiangshan
    Signed-off-by: Paul E. McKenney

    Lai Jiangshan
     
  • This patch adds a check to __rcu_pending() that does a local
    set_need_resched() if the current CPU is holding up the current grace
    period and if force_quiescent_state() will be called soon. The goal is
    to reduce the probability that force_quiescent_state() will need to do
    smp_send_reschedule(), which sends an IPI and is therefore more expensive
    on most architectures.

    Signed-off-by: "Paul E. McKenney"

    Paul E. McKenney
     

27 Feb, 2010

1 commit

  • It is invalid to invoke __rcu_process_callbacks() with irqs
    disabled, so do it indirectly via raise_softirq(). This
    requires a state-machine implementation to cycle through the
    grace-period machinery the required number of times.

    Located-by: Ingo Molnar
    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     

26 Feb, 2010

1 commit

  • Before the scheduler starts, all tasks are non-preemptible by
    definition. So, during that time, rcu_read_lock_sched_held()
    needs to always return "true". This patch makes that be so.

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     

25 Feb, 2010

5 commits

  • When RCU detects a grace-period stall, it currently just prints
    out the PID of any tasks doing the stalling. This patch adds
    RCU_CPU_STALL_VERBOSE, which enables the more-verbose reporting
    from sched_show_task().

    Suggested-by: Thomas Gleixner
    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • Under TREE_PREEMPT_RCU, print_other_cpu_stall() invokes
    rcu_print_task_stall() with the root rcu_node structure's ->lock
    held, and rcu_print_task_stall() acquires that same lock for
    self-deadlock. Fix this by removing the lock acquisition from
    rcu_print_task_stall(), and making all callers acquire the lock
    instead.

    Tested-by: John Kacur
    Tested-by: Thomas Gleixner
    Located-by: Thomas Gleixner
    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • The spinlocks in rcutree need to be real spinlocks in
    preempt-rt. Convert them to raw_spinlocks.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • The C standard does not specify the result of an operation that
    overflows a signed integer, so such operations need to be
    avoided. This patch changes the type of several fields from
    "long" to "unsigned long" and adjusts operations as needed.
    ULONG_CMP_GE() and ULONG_CMP_LT() macros are introduced to do
    the modular comparisons that are appropriate given that overflow
    is an expected event.

    Acked-by: Mathieu Desnoyers
    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • Currently, rcu_needs_cpu() simply checks whether the current CPU
    has an outstanding RCU callback, which means that the last CPU
    to go into dyntick-idle mode might wait a few ticks for the
    relevant grace periods to complete. However, if all the other
    CPUs are in dyntick-idle mode, and if this CPU is in a quiescent
    state (which it is for RCU-bh and RCU-sched any time that we are
    considering going into dyntick-idle mode), then the grace period
    is instantly complete.

    This patch therefore repeatedly invokes the RCU grace-period
    machinery in order to force any needed grace periods to complete
    quickly. It does so a limited number of times in order to
    prevent starvation by an RCU callback function that might pass
    itself to call_rcu().

    However, if any CPU other than the current one is not in
    dyntick-idle mode, fall back to simply checking (with fix to bug
    noted by Lai Jiangshan). Also, take advantage of last
    grace-period forcing, the opportunity to do so noted by Steve
    Rostedt. And apply simplified #ifdef condition suggested by
    Frederic Weisbecker.

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     

16 Jan, 2010

1 commit

  • Rename local variable "i" in rcu_init() to avoid conflict with
    RCU_INIT_FLAVOR(), restrict the scope of RCU_TREE_NONCORE, and
    make __synchronize_srcu() static.

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     

13 Jan, 2010

12 commits

  • Previously, each level of the rcu_node hierarchy had the same
    rather unimaginative name: "&rcu_node_class[i]". This makes
    lockdep diagnostics involving these lockdep classes less helpful
    than would be nice. This patch fixes this by giving each level
    of the rcu_node hierarchy a distinct name: "rcu_node_level_0",
    "rcu_node_level_1", and so on. This version of the patch
    includes improved diagnostics suggested by Josh Triplett and
    Peter Zijlstra.

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • Add force_quiescent_state() testing to rcutorture, with a
    separate thread that repeatedly invokes force_quiescent_state()
    in bursts. This can greatly increase the probability of
    encountering certain types of race conditions.

    Suggested-by: Josh Triplett
    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • Grace periods cannot be started while force_quiescent_state() is
    active. This is OK in that the affected CPUs will try again
    later, but it does induce needless grace-period delays. This
    patch causes rcu_start_gp() to record a failed attempt to start
    a grace period. When force_quiescent_state() prepares to return,
    it then starts the grace period if there was such a failed
    attempt.

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • The rcu_process_dyntick() function checks twice for the end of
    the current grace period. However, it holds the current
    rcu_node structure's ->lock field throughout, and doesn't get to
    the second call to rcu_gp_in_progress() unless there is at least
    one CPU corresponding to this rcu_node structure that has not
    yet checked in for the current grace period, which would prevent
    the current grace period from ending. So the current grace
    period cannot have ended, and the second check is redundant, so
    remove it.

    Also, given that this function is used even with !CONFIG_NO_HZ,
    its name is quite misleading. Change from rcu_process_dyntick()
    to force_qs_rnp().

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • The comparisons of rsp->gpnum nad rsp->completed in
    rcu_process_dyntick() and force_quiescent_state() can be
    replaced by the much more clear rcu_gp_in_progress() predicate
    function. After doing this, it becomes clear that the
    RCU_SAVE_COMPLETED leg of the force_quiescent_state() function's
    switch statement is almost completely a no-op. A small change
    to the RCU_SAVE_DYNTICK leg renders it a complete no-op, after
    which it can be removed. Doing so also eliminates the forcenow
    local variable from force_quiescent_state().

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • Because a new grace period cannot start while we are executing
    within the force_quiescent_state() function's switch statement,
    if any test within that switch statement or within any function
    called from that switch statement shows that the current grace
    period has ended, we can safely re-do that test any time before
    we leave the switch statement. This means that we no longer
    need a return value from rcu_process_dyntick(), as we can simply
    invoke rcu_gp_in_progress() to check whether the old grace
    period has finished -- there is no longer any need to worry
    about whether or not a new grace period has been started.

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • At this point, the second argument to all calls to
    rcu_process_dyntick() is a function of the same field of the
    structure passed in as the first argument, namely, rsp->gpnum-1.
    So propagate rsp->gpnum-1 to all uses of the second argument
    within rcu_process_dyntick() and then eliminate the second
    argument.

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • Because rsp->fqs_active is set to 1 across
    force_quiescent_state()'s switch statement, rcu_start_gp() will
    refrain from starting a new grace period during this time.
    Therefore, rsp->gpnum is constant, and can be propagated to all
    uses of lastcomp, eliminating this local variable.

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • Because the root rcu_node lock is held across entry to the
    switch statement in force_quiescent_state(), it is no longer
    necessary to snapshot rsp->signaled to a local variable.
    Eliminate both the snapshotting and the local variable.

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • Reduce the number and variety of race conditions by prohibiting
    the start of a new grace period while force_quiescent_state() is
    active. A new fqs_active flag in the rcu_state structure is used
    to trace whether or not force_quiescent_state() is active, and
    this new flag is tested by rcu_start_gp(). If the CPU that
    closed out the last grace period needs another grace period,
    this new grace period may be delayed up to one scheduling-clock
    tick, but it will eventually get started.

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • This patch releases rnp->lock after the end of
    force_quiescent_state()'s switch statement. This is a second
    step towards prohibiting starting grace periods while
    force_quiescent_state() is executing, which will reduce the
    number and complexity of races that force_quiescent_state() is
    involved in.

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • This causes rnp->lock to be held on entry to
    force_quiescent_state()'s switch statement. This is a first
    step towards prohibiting starting grace periods while
    force_quiescent_state() is executing, which will reduce the
    number and complexity of races that force_quiescent_state() is
    involved in.

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     

03 Dec, 2009

2 commits

  • Implement an synchronize_rcu_expedited() for preemptible RCU
    that actually is expedited. This uses
    synchronize_sched_expedited() to force all threads currently
    running in a preemptible-RCU read-side critical section onto the
    appropriate ->blocked_tasks[] list, then takes a snapshot of all
    of these lists and waits for them to drain.

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • Enable a fourth level of rcu_node hierarchy for TREE_RCU and
    TREE_PREEMPT_RCU. This is for stress-testing and experiemental
    purposes only, although in theory this would enable 16,777,216
    CPUs on 64-bit systems, though only 1,048,576 CPUs on 32-bit
    systems. Normal experimental use of this fourth level will
    normally set CONFIG_RCU_FANOUT=2, requiring a 16-CPU system,
    though the more adventurous (and more fortunate) experimenters
    may wish to chose CONFIG_RCU_FANOUT=3 for 81-CPU systems or even
    CONFIG_RCU_FANOUT=4 for 256-CPU systems.

    Signed-off-by: Paul E. McKenney
    Acked-by: Josh Triplett
    Acked-by: Lai Jiangshan
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney