• Oleg Nesterov's avatar
    [PATCH] rcu: eliminate rcu_ctrlblk.lock · a48d69a5
    Oleg Nesterov authored
    rcu_ctrlblk.lock is used to read the ->cur and ->next_pending
    atomically in __rcu_process_callbacks(). It can be replaced
    by a couple of memory barriers.
    
    rcu_start_batch:
    	rcp->next_pending = 0;
    	smp_wmb();
    	rcp->cur++;
    
    __rcu_process_callbacks:
    	rdp->batch = rcp->cur + 1;
    	smp_rmb();
    	if (!rcp->next_pending)
    		rcu_start_batch(rcp, rsp, 1);
    
    This way, if __rcu_process_callbacks() sees incremented ->cur value,
    it must also see that ->next_pending == 0 (or rcu_start_batch() is
    already in progress on another cpu).
    Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    a48d69a5
rcupdate.c 13.7 KB