rcu: Advance outgoing CPU's callbacks before migrating them
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 26 Jun 2017 22:43:27 +0000 (15:43 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 25 Jul 2017 20:04:47 +0000 (13:04 -0700)
commit9fa46fb8c9c6dfad30487fb3d905c2ff04b379b7
tree5ee89ccbbac6ff2418ebaf4e2a2c4dab9ae49f00
parentb1a2d79fe7d210c114003362d93d529912d244df
rcu: Advance outgoing CPU's callbacks before migrating them

It is possible that the outgoing CPU is unaware of recent grace periods,
and so it is also possible that some of its pending callbacks are actually
ready to be invoked.  The current callback-migration code would needlessly
force these callbacks to pass through another grace period.  This commit
therefore invokes rcu_advance_cbs() on the outgoing CPU's callbacks in
order to give them full credit for having passed through any recent
grace periods.

This also fixes an odd theoretical bug where there are no callbacks in
the system except for those on the outgoing CPU, none of those callbacks
have yet been associated with a grace-period number, there is never again
another callback registered, and the surviving CPU never again takes a
scheduling-clock interrupt, never goes idle, and never enters nohz_full
userspace execution.  Yes, this is (just barely) possible.  It requires
that the surviving CPU be a nohz_full CPU, that its scheduler-clock
interrupt be shut off, and that it loop forever in the kernel.  You get
bonus points if you can make this one happen!  ;-)

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
kernel/rcu/tree.c