• Lai Jiangshan's avatar
    srcu: use ACCESS_ONCE() to access sp->completed in srcu_read_lock() · 7a6b55e7
    Lai Jiangshan authored
    The old SRCU implementation loads sp->completed within an
    RCU-sched section, courtesy of preempt_disable().  This was required
    due to the use of synchronize_sched() in the old implemenation's
    synchronize_srcu().  However, the new implementation does not rely
    on synchronize_sched(), so it in turn does not require the load of
    sp->completed and the ->c[] counter to be in a single preempt-disabled
    region of code.  This commit therefore moves the sp->completed access
    outside of the preempt-disabled region and applies ACCESS_ONCE().
    The resulting code is almost as the same as before, but it removes the
    now-misleading rcu_dereference_index_check() call.
    Signed-off-by: 's avatarLai Jiangshan <laijs@cn.fujitsu.com>
    Signed-off-by: 's avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
srcu.c 19.5 KB