lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <be57ed09-83d9-48a0-bfcc-d22ce39ad17d@gmail.com>
Date: Wed, 18 Sep 2024 16:30:57 +0800
From: hupu <hupu.gm@...il.com>
To: Ingo Molnar <mingo@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
 Juri Lelli <juri.lelli@...hat.com>,
 Vincent Guittot <vincent.guittot@...aro.org>,
 Dietmar Eggemann <dietmar.eggemann@....com>,
 Steven Rostedt <rostedt@...dmis.org>, Ben Segall <bsegall@...gle.com>,
 Mel Gorman <mgorman@...e.de>, Valentin Schneider <vschneid@...hat.com>,
 linux-kernel@...r.kernel.org
Subject: [PATCH] sched: Fix the comment error in the wait_task_inactive
 interface.

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@...il.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ