• L
    rcu: rcu_barrier VS cpu_hotplug: Ensure callbacks in dead cpu are migrated to online cpu · f69b17d7
    Lai Jiangshan 提交于
    cpu hotplug may happen asynchronously, some rcu callbacks are maybe
    still on dead cpu, rcu_barrier() also needs to wait for these rcu
    callbacks to complete, so we must ensure callbacks in dead cpu are
    migrated to online cpu.
    
    Paul E. McKenney's review:
    
      Good stuff, Lai!!!  Simpler than any of the approaches that I was
      considering, and, better yet, independent of the underlying RCU
      implementation!!!
    
      I was initially worried that wake_up() might wake only one of two
      possible wait_event()s, namely rcu_barrier() and the CPU_POST_DEAD code,
      but the fact that wait_event() clears WQ_FLAG_EXCLUSIVE avoids that issue.
      I was also worried about the fact that different RCU implementations have
      different mappings of call_rcu(), call_rcu_bh(), and call_rcu_sched(), but
      this is OK as well because we just get an extra (harmless) callback in the
      case that they map together (for example, Classic RCU has call_rcu_sched()
      mapping to call_rcu()).
    
      Overlap of CPU-hotplug operations is prevented by cpu_add_remove_lock,
      and any stray callbacks that arrive (for example, from irq handlers
      running on the dying CPU) either are ahead of the CPU_DYING callbacks on
      the one hand (and thus accounted for), or happened after the rcu_barrier()
      started on the other (and thus don't need to be accounted for).
    Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
    Reviewed-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    LKML-Reference: <49C36476.1010400@cn.fujitsu.com>
    Signed-off-by: NIngo Molnar <mingo@elte.hu>
    f69b17d7
rcupdate.c 6.6 KB