From: hupu <hupu.gm@gmail.com>
To: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] sched: Fix the comment error in the wait_task_inactive interface.
Date: Wed, 18 Sep 2024 16:30:57 +0800 [thread overview]
Message-ID: <be57ed09-83d9-48a0-bfcc-d22ce39ad17d@gmail.com> (raw)
The previous comment was incorrect because "task_on_cpu" only care about
p->on_cpu and does not care whether the runqueue has changed or not,
especially on SMP systems. In addition, task_on_cpu returns true
instead of false when p is running on a CPU.
Signed-off-by: hupu<hupu.gm@gmail.com>
---
kernel/sched/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f3951e4a55e5..05b231a18440 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2129,8 +2129,8 @@ unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_state
* NOTE! Since we don't hold any locks, it's not
* even sure that "rq" stays as the right runqueue!
* But we don't care, since "task_on_cpu()" will
- * return false if the runqueue has changed and p
- * is actually now running somewhere else!
+ * return true as long as p is running on a CPU,
+ * regardless of any changes to the runqueue.
*/
while (task_on_cpu(rq, p)) {
if (!task_state_match(p, match_state))
-- 2.17.1
next reply other threads:[~2024-09-18 8:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-18 8:30 hupu [this message]
2024-09-26 7:36 ` [RESEND PATCH] sched: Fix the comment error in the wait_task_inactive interface hupu
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=be57ed09-83d9-48a0-bfcc-d22ce39ad17d@gmail.com \
--to=hupu.gm@gmail.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/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