08 May, 2011

12 commits


06 May, 2011

28 commits

  • Provide rcu_virt_note_context_switch() for vitalization use to note
    quiescent state during guest entry.

    Signed-off-by: Gleb Natapov
    Signed-off-by: Paul E. McKenney

    Gleb Natapov
     
  • Signed integer overflow is undefined by the C standard, so move
    calculations to unsigned.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • rcu_sched_qs() currently calls local_irq_save()/local_irq_restore() up
    to three times.

    Remove irq masking from rcu_qsctr_help() / invoke_rcu_kthread()
    and do it once in rcu_sched_qs() / rcu_bh_qs()

    This generates smaller code as well.

    text data bss dec hex filename
    2314 156 24 2494 9be kernel/rcutiny.old.o
    2250 156 24 2430 97e kernel/rcutiny.new.o

    Fix an outdated comment for rcu_qsctr_help()
    Move invoke_rcu_kthread() definition before its use.

    Signed-off-by: Eric Dumazet
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Josh Triplett

    Eric Dumazet
     
  • This commit marks a first step towards making call_rcu() have
    real-time behavior. If irqs are disabled, don't dive into the
    RCU core. Later on, this new early exit will wake up the
    per-CPU kthread, which first must be modified to handle the
    cases involving callback storms.

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

    Paul E. McKenney
     
  • Although rcu_yield() dropped from real-time to normal priority, there
    is always the possibility that the competing tasks have been niced.
    So nice to 19 in rcu_yield() to help ensure that other tasks have a
    better chance of running.

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

    Paul E. McKenney
     
  • Many rcu callbacks functions just call kfree() on the base structure.
    These functions are trivial, but their size adds up, and furthermore
    when they are used in a kernel module, that module must invoke the
    high-latency rcu_barrier() function at module-unload time.

    The kfree_rcu() function introduced by this commit addresses this issue.
    Rather than encoding a function address in the embedded rcu_head
    structure, kfree_rcu() instead encodes the offset of the rcu_head
    structure within the base structure. Because the functions are not
    allowed in the low-order 4096 bytes of kernel virtual memory, offsets
    up to 4095 bytes can be accommodated. If the offset is larger than
    4095 bytes, a compile-time error will be generated in __kfree_rcu().
    If this error is triggered, you can either fall back to use of call_rcu()
    or rearrange the structure to position the rcu_head structure into the
    first 4096 bytes.

    Note that the allowable offset might decrease in the future, for example,
    to allow something like kmem_cache_free_rcu().

    The new kfree_rcu() function can replace code as follows:

    call_rcu(&p->rcu, simple_kfree_callback);

    where "simple_kfree_callback()" might be defined as follows:

    void simple_kfree_callback(struct rcu_head *p)
    {
    struct foo *q = container_of(p, struct foo, rcu);

    kfree(q);
    }

    with the following:

    kfree_rcu(&p->rcu, rcu);

    Note that the "rcu" is the name of a field in the structure being
    freed. The reason for using this rather than passing in a pointer
    to the base structure is that the above approach allows better type
    checking.

    This commit is based on earlier work by Lai Jiangshan and Manfred Spraul:

    Lai's V1 patch: http://lkml.org/lkml/2008/9/18/1
    Manfred's patch: http://lkml.org/lkml/2009/1/2/115

    Signed-off-by: Lai Jiangshan
    Signed-off-by: Manfred Spraul
    Signed-off-by: Paul E. McKenney
    Reviewed-by: David Howells
    Reviewed-by: Josh Triplett

    Lai Jiangshan
     
  • The "preemptible" spelling is preferable. May as well fix it.

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

    Paul E. McKenney
     
  • Using __rcu_read_lock() in place of rcu_read_lock() leaves any debug
    state as it really should be, namely with the lock still held.

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

    Lai Jiangshan
     
  • This applies a trick from TREE_RCU boosting to TINY_RCU, eliminating
    code and adding comments. The key point is that it is possible for
    the booster thread itself to work out whether there is a normal or
    expedited boost required based solely on local information. There
    is therefore no need for boost initiation to know or care what type
    of boosting is required. In addition, when boosting is complete for
    a given grace period, then by definition there cannot be any more
    boosting for that grace period. This allows eliminating yet more
    state and statistics.

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

    Paul E. McKenney
     
  • The ->boosted_this_gp field is a holdover from an earlier design that
    was to carry out multiple boost operations in parallel. It is not required
    by the current design, which boosts one task at a time.

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

    Paul E. McKenney
     
  • Extraneous semicolon, bad comment, and fold INIT_LIST_HEAD() into
    list_del() to get list_del_init().

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

    Paul E. McKenney
     
  • This removes a couple of lines from invoke_rcu_cpu_kthread(), improving
    readability.

    Reported-by: Christoph Lameter
    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Josh Triplett

    Paul E. McKenney
     
  • Avoid additional multiple-warning confusion in memory-corruption scenarios.

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

    Paul E. McKenney
     
  • The CONFIG_DEBUG_OBJECTS_RCU_HEAD facility requires that on-stack RCU
    callbacks be flagged explicitly to debug-objects using the
    init_rcu_head_on_stack() and destroy_rcu_head_on_stack() functions.
    This commit applies those functions to the rcutorture code that tests
    RCU priority boosting.

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

    Paul E. McKenney
     
  • Verify that rcu_head structures are aligned to a four-byte boundary.
    This check is enabled by CONFIG_DEBUG_OBJECTS_RCU_HEAD.

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

    Paul E. McKenney
     
  • The prohibition of DEBUG_OBJECTS_RCU_HEAD from !PREEMPT was due to the
    fixup actions. So just produce a warning from !PREEMPT.

    Signed-off-by: Mathieu Desnoyers
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Josh Triplett

    Mathieu Desnoyers
     
  • Increment a per-CPU counter on each pass through rcu_cpu_kthread()'s
    service loop, and add it to the rcudata trace output.

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

    Paul E. McKenney
     
  • This commit adds the age in jiffies of the current grace period along
    with the duration in jiffies of the longest grace period since boot
    to the rcu/rcugp debugfs file. It also adds an additional "O" state
    to kthread tracing to differentiate between the kthread waiting due to
    having nothing to do on the one hand and waiting due to being on the
    wrong CPU on the other hand.

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

    Paul E. McKenney
     
  • The rcu_initiate_boost_trace() function mis-attributed refusals to
    initiate RCU priority boosting that were in fact due to its not yet
    being time to boost. This patch fixes the faulty comparison.

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

    Paul E. McKenney
     
  • This commit documents the new debugfs rcu/rcutorture and rcu/rcuboost
    trace files. The description has been updated as suggested by Josh
    Triplett.

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

    Paul E. McKenney
     
  • It is not possible to accurately correlate rcutorture output with that
    of debugfs. This patch therefore adds a debugfs file that prints out
    the rcutorture version number, permitting easy correlation.

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

    Paul E. McKenney
     
  • Add tracing to help debugging situations when RCU's kthreads are not
    running but are supposed to be.

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

    Paul E. McKenney
     
  • This commit adds an indication of the state of the callback queue using
    a string of four characters following the "ql=" integer queue length.
    The first character is "N" if there are callbacks that have been
    queued that are not yet ready to be handled by the next grace period, or
    "." otherwise. The second character is "R" if there are callbacks queued
    that are ready to be handled by the next grace period, or "." otherwise.
    The third character is "W" if there are callbacks waiting for the current
    grace period, or "." otherwise. Finally, the fourth character is "D"
    if there are callbacks that have been handled by a prior grace period
    and are waiting to be invoked, or ".".

    Note that callbacks that are in the process of being invoked are
    not shown. These callbacks would have been removed from the rcu_data
    structure's list by rcu_do_batch() prior to being executed. (These
    callbacks are also not reflected in the "ql=" total, FWIW.)

    Also, document the new callback-queue trace information.

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

    Paul E. McKenney
     
  • The trace.txt file had obsolete output for the debugfs rcu/rcudata
    file, so update it.

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

    Paul E. McKenney
     
  • Includes total number of tasks boosted, number boosted on behalf of each
    of normal and expedited grace periods, and statistics on attempts to
    initiate boosting that failed for various reasons.

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

    Paul E. McKenney
     
  • The n_rcu_torture_boost_allocerror and n_rcu_torture_boost_afferror
    statistics are not actually incremented anymore, so eliminate them.

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

    Paul E. McKenney
     
  • The scheduler does not appear to take kindly to having multiple
    real-time threads bound to a CPU that is going offline. So this
    commit is a temporary hack-around to avoid that happening.

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

    Paul E. McKenney
     
  • If you are doing CPU hotplug operations, it is best not to have
    CPU-bound realtime tasks running CPU-bound on the outgoing CPU.
    So this commit makes per-CPU kthreads run at non-realtime priority
    during that time.

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

    Paul E. McKenney