From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>,
Linus Torvalds <torvalds@linux-foundation.org>,
Roland McGrath <roland@redhat.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] wait_task_inactive: "improve" the returned value for ->nvcsw == 0
Date: Wed, 30 Jul 2008 21:09:48 +0400 [thread overview]
Message-ID: <20080730170948.GA18676@tv-sign.ru> (raw)
(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);
/*
next reply other threads:[~2008-07-30 17:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-30 17:09 Oleg Nesterov [this message]
2008-07-31 0:37 ` Roland McGrath
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080730170948.GA18676@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=roland@redhat.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®