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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221103120720.39873-3-zhangqiao22@huawei.com>
Date:   Thu, 3 Nov 2022 20:07:20 +0800
From:   Zhang Qiao <zhangqiao22@...wei.com>
To:     <mingo@...hat.com>, <peterz@...radead.org>,
        <juri.lelli@...hat.com>, <vincent.guittot@...aro.org>,
        <linux-kernel@...r.kernel.org>
CC:     <dietmar.eggemann@....com>, <rostedt@...dmis.org>,
        <bsegall@...gle.com>, <mgorman@...e.de>, <bristot@...hat.com>,
        <vschneid@...hat.com>, <brauner@...nel.org>,
        <yusongping@...wei.com>, Zhang Qiao <zhangqiao22@...wei.com>
Subject: [PATCH v2 2/2] sched: Fix sched_child_runs_first

There are two cases that the sched_child_runs_first maybe not
work fine:
1) when call clone3() with CLONE_INTO_CGROUP flags, will creating
the child task into a cgroup different from the parent's cgroup,
so that child and parent's cfs_rq is diffent.
2) Assign a different cpu to the new task when fork balancing.

Above two case, the child and the parent will attach to different
cpu and cfs_rq. At this time, we can't swap the child and parent's
vruntime, and i think only do swap vruntime when the parent and
child in the same cfs_rq. This patch will add the cfs_rq check
before swap vruntime.

Signed-off-by: Zhang Qiao <zhangqiao22@...wei.com>
---
 kernel/sched/fair.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 34845d425180..6061ceb1b7cb 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -11612,7 +11612,9 @@ static void task_fork_fair(struct task_struct *p)
 	}
 	place_entity(cfs_rq, se, 1);
 
-	if (sysctl_sched_child_runs_first && curr && entity_before(curr, se)) {
+	if (sysctl_sched_child_runs_first &&
+		cfs_rq == task_cfs_rq(current) &&
+		curr && entity_before(curr, se)) {
 		/*
 		 * Upon rescheduling, sched_class::put_prev_task() will place
 		 * 'current' within the tree based on its new key value.
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ