What about using CPU_DYING and CPU_STARTING?
Then this race wouldn't exist anymore.
Hmm - your code must loop multiple times over the cpus.
I've use a different approach: More forcing is only required for a nohz
cpu when it was hit within a long-running interrupt.
Thus I've added a '->kick_poller' flag, rcu_irq_exit() reports back when
the long-running interrupt completes. Never more than one loop over the
outstanding cpus is required.
--
Manfred
--