aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-08-20 19:54:44 -0400
committerIngo Molnar <mingo@elte.hu>2008-08-22 09:17:31 -0400
commit93dcf55f828b035fc93fc19eb03c1390e1e6d570 (patch)
tree8a5b2ee5c5bb664ff856483244cec1f249a129a3 /kernel/sched.c
parentf31e11d87a5d7601636710195891ba462ad99f11 (diff)
wait_task_inactive: "improve" the returned value for ->nvcsw == 0
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@tv-sign.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 908670aa215a..6a43c8942b05 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1922,7 +1922,7 @@ unsigned long wait_task_inactive(struct task_struct *p, long match_state)
1922 on_rq = p->se.on_rq; 1922 on_rq = p->se.on_rq;
1923 ncsw = 0; 1923 ncsw = 0;
1924 if (!match_state || p->state == match_state) 1924 if (!match_state || p->state == match_state)
1925 ncsw = p->nvcsw ?: 1; 1925 ncsw = p->nvcsw | LONG_MIN; /* sets MSB */
1926 task_rq_unlock(rq, &flags); 1926 task_rq_unlock(rq, &flags);
1927 1927
1928 /* 1928 /*