• Paul E. McKenney's avatar
    rcu: Add rcu_gp_might_be_stalled() · 6be7436d
    Paul E. McKenney authored
    This commit adds rcu_gp_might_be_stalled(), which returns true if there
    is some reason to believe that the RCU grace period is stalled.  The use
    case is where an RCU free-memory path needs to allocate memory in order
    to free it, a situation that should be avoided where possible.
    
    But where it is necessary, there is always the alternative of using
    synchronize_rcu() to wait for a grace period in order to avoid the
    allocation.  And if the grace period is stalled, allocating memory to
    asynchronously wait for it is a bad idea of epic proportions: Far better
    to let others use the memory, because these others might actually be
    able to free that memory before the grace period ends.
    
    Thus, rcu_gp_might_be_stalled() can be used to help decide whether
    allocating memory on an RCU free path is a semi-reasonable course
    of action.
    
    Cc: Joel Fernandes <joel@joelfernandes.org>
    Cc: Uladzislau Rezki <urezki@gmail.com>
    Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
    6be7436d
tree_stall.h 23 KB