• Paul E. McKenney's avatar
    rcu: Add rcutree.nohz_full_patience_delay to reduce nohz_full OS jitter · 68d124b0
    Paul E. McKenney authored
    If a CPU is running either a userspace application or a guest OS in
    nohz_full mode, it is possible for a system call to occur just as an
    RCU grace period is starting.  If that CPU also has the scheduling-clock
    tick enabled for any reason (such as a second runnable task), and if the
    system was booted with rcutree.use_softirq=0, then RCU can add insult to
    injury by awakening that CPU's rcuc kthread, resulting in yet another
    task and yet more OS jitter due to switching to that task, running it,
    and switching back.
    
    In addition, in the common case where that system call is not of
    excessively long duration, awakening the rcuc task is pointless.
    This pointlessness is due to the fact that the CPU will enter an extended
    quiescent state upon returning to the userspace application or guest OS.
    In this case, the rcuc kthread cannot do anything that the main RCU
    grace-period kthread cannot do on its behalf, at least if it is given
    a few additional milliseconds (for example, given the time duration
    specified by rcutree.jiffies_till_first_fqs, give or take scheduling
    delays).
    
    This commit therefore adds a rcutree.nohz_full_patience_delay kernel
    boot parameter that specifies the grace period age (in milliseconds,
    rounded to jiffies) before which RCU will refrain from awakening the
    rcuc kthread.  Preliminary experimentation suggests a value of 1000,
    that is, one second.  Increasing rcutree.nohz_full_patience_delay will
    increase grace-period latency and in turn increase memory footprint,
    so systems with constrained memory might choose a smaller value.
    Systems with less-aggressive OS-jitter requirements might choose the
    default value of zero, which keeps the traditional immediate-wakeup
    behavior, thus avoiding increases in grace-period latency.
    
    [ paulmck: Apply Leonardo Bras feedback.  ]
    
    Link: https://lore.kernel.org/all/20240328171949.743211-1-leobras@redhat.com/Reported-by: default avatarLeonardo Bras <leobras@redhat.com>
    Suggested-by: default avatarLeonardo Bras <leobras@redhat.com>
    Suggested-by: default avatarSean Christopherson <seanjc@google.com>
    Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
    Reviewed-by: default avatarLeonardo Bras <leobras@redhat.com>
    68d124b0
kernel-parameters.txt 269 KB