Re: [PATCH 2/7] sched, preempt: Fixup missed PREEMPT_NEED_RESCHED folding

Peter Zijlstra
2013-11-21T08:25:36Z

On Wed, Nov 20, 2013 at 05:04:52PM +0100, Peter Zijlstra wrote:
> --- a/kernel/cpu/idle.c
> +++ b/kernel/cpu/idle.c
> @@ -105,14 +105,14 @@ static void cpu_idle_loop(void)
> __current_set_polling();
> }
> arch_cpu_idle_exit();
> - /*
> - * We need to test and propagate the TIF_NEED_RESCHED
> - * bit here because we might not have send the
> - * reschedule IPI to idle tasks.
> - */
> - if (tif_need_resched())
> - set_preempt_need_resched();
> }

/*
* Ensure our read doesn't slip before the read that
* terminates the loop above; in that situation we might
* actually fail to observe the TIF_NEED_RESCHED we
* _know_ must be set here.
*/

smp_rmb(); /* pairs with resched_task() */

> +
> + /*
> + * We need to test and propagate the TIF_NEED_RESCHED bit here
> + * because we might not have send the reschedule IPI to idle
> + * tasks.
> + */
> + preempt_fold_need_resched();
> tick_nohz_idle_exit();
> schedule_preempt_disabled();
> }