• Paul E. McKenney's avatar
    srcu: Eliminate possibility of destructive counter overflow · 881ec9d2
    Paul E. McKenney authored
    Earlier versions of Tree SRCU were subject to a counter overflow bug that
    could theoretically result in too-short grace periods.  This commit
    eliminates this problem by adding an update-side memory barrier.
    The short explanation is that if the updater sums the unlock counts
    too late to see a given __srcu_read_unlock() increment, that CPU's
    next __srcu_read_lock() must see the new value of ->srcu_idx, thus
    incrementing the other bank of counters.  This eliminates the possibility
    of destructive counter overflow as long as the srcu_read_lock() nesting
    level does not exceed floor(ULONG_MAX/NR_CPUS/2), which should be an
    eminently reasonable nesting limit, especially on 64-bit systems.
    Reported-by: default avatarLance Roy <ldr709@gmail.com>
    Suggested-by: default avatarLance Roy <ldr709@gmail.com>
    Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
    881ec9d2
srcutree.c 38.7 KB