The patch titled wait_task_inactive: "improve" the returned value for ->nvcsw == 0 has been added to the -mm tree. Its filename is wait_task_inactive-improve-the-returned-value-for-nvcsw-==-0.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: wait_task_inactive: "improve" the returned value for ->nvcsw == 0 From: Oleg Nesterov <oleg@xxxxxxxxxx> wait_task_inactive() returns 1 when p->nvcsw == 0 || p->nvcsw == 1. This means that two subsequent calls can return the same number while the task was scheduled in between. Change the code to return "nvcsw | LONG_MIN" instead of "nvcsw ?: 1", now the overlap always needs LONG_MAX schedules. Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Acked-by: Roland McGrath <roland@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -puN kernel/sched.c~wait_task_inactive-improve-the-returned-value-for-nvcsw-==-0 kernel/sched.c --- a/kernel/sched.c~wait_task_inactive-improve-the-returned-value-for-nvcsw-==-0 +++ a/kernel/sched.c @@ -1923,7 +1923,7 @@ unsigned long wait_task_inactive(struct on_rq = p->se.on_rq; ncsw = 0; if (!match_state || p->state == match_state) - ncsw = p->nvcsw ?: 1; + ncsw = p->nvcsw | LONG_MIN; /* sets MSB */ task_rq_unlock(rq, &flags); /* _ Patches currently in -mm which might be from oleg@xxxxxxxxxx are origin.patch semaphore-__down_common-use-signal_pending_state.patch proc-fix-warnings.patch linux-next.patch migrate_timers-add-comment-use-spinlock_irq.patch sched-do_wait_for_common-use-signal_pending_state.patch wait_task_inactive-dont-consider-task-nivcsw.patch wait_task_inactive-improve-the-returned-value-for-nvcsw-==-0.patch posix-timers-fix-posix_timer_event-vs-dequeue_signal-race.patch posix-timers-do_schedule_next_timer-fix-the-setting-of-si_overrun.patch posix-timers-dont-switch-to-group_leader-if-it_process-dies.patch posix-timers-always-do-get_task_structtimer-it_process.patch posix-timers-sys_timer_create-remove-the-buggy-pf_exiting-check.patch posix-timers-sys_timer_create-simplify-and-s-tasklist-rcu.patch posix-timers-move-the-initialization-of-timer-sigq-from-send-to-create-path.patch posix-timers-sys_timer_create-cleanup-the-error-handling.patch posix-timers-kill-it_sigev_signo-and-it_sigev_value.patch posix-timers-lock_timer-kill-the-bogus-it_id-check.patch posix-timers-lock_timer-make-it-readable.patch coredump-format_corename-dont-append-%pid-if-multi-threaded.patch kthread_bind-use-wait_task_inactivetask_uninterruptible.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html