mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] wait_task_inactive: "improve" the returned value for ->nvcsw == 0
@ 2008-07-30 17:09 Oleg Nesterov
  2008-07-31  0:37 ` Roland McGrath
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2008-07-30 17:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Ingo Molnar, Linus Torvalds, Roland McGrath, linux-kernel

(on top of wait_task_inactive-dont-consider-task-nivcsw.patch)

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>

--- 27/kernel/sched.c~1_WTI_RET	2008-07-30 19:32:09.000000000 +0400
+++ 27/kernel/sched.c	2008-07-30 19:47:56.000000000 +0400
@@ -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);
 
 		/*


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/3] wait_task_inactive: "improve" the returned value for ->nvcsw == 0
  2008-07-30 17:09 [PATCH 1/3] wait_task_inactive: "improve" the returned value for ->nvcsw == 0 Oleg Nesterov
@ 2008-07-31  0:37 ` Roland McGrath
  0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2008-07-31  0:37 UTC (permalink / raw)
  To: Oleg Nesterov; +Cc: Andrew Morton, Ingo Molnar, Linus Torvalds, linux-kernel

Acked-by: Roland McGrath <roland@redhat.com>


Thanks,
Roland

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-31  0:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-30 17:09 [PATCH 1/3] wait_task_inactive: "improve" the returned value for ->nvcsw == 0 Oleg Nesterov
2008-07-31  0:37 ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®