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-next>] [day] [month] [year] [list]
Message-Id: <1650831454-101777-1-git-send-email-CruzZhao@linux.alibaba.com>
Date:   Mon, 25 Apr 2022 04:17:34 +0800
From:   Cruz Zhao <CruzZhao@...ux.alibaba.com>
To:     mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
        vincent.guittot@...aro.org, dietmar.eggemann@....com,
        rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
        bristot@...hat.com
Cc:     linux-kernel@...r.kernel.org
Subject: [PATCH v2] sched/core: Skip sched_core_fork/free() when core sched is disabled

As __put_task_struct() and copy_process() are hot path functions,
the call of sched_core_fork/free() will bring overhead when core
sched is disabled, and we skip them in these cases.

Reported-by: kernel test robot <lkp@...el.com>
Signed-off-by: Cruz Zhao <CruzZhao@...ux.alibaba.com>
---
 kernel/sched/core_sched.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/core_sched.c b/kernel/sched/core_sched.c
index 38a2cec..72a8ef8 100644
--- a/kernel/sched/core_sched.c
+++ b/kernel/sched/core_sched.c
@@ -108,13 +108,16 @@ static unsigned long sched_core_clone_cookie(struct task_struct *p)
 
 void sched_core_fork(struct task_struct *p)
 {
-	RB_CLEAR_NODE(&p->core_node);
-	p->core_cookie = sched_core_clone_cookie(current);
+	if (!sched_core_disabled()) {
+		RB_CLEAR_NODE(&p->core_node);
+		p->core_cookie = sched_core_clone_cookie(current);
+	}
 }
 
 void sched_core_free(struct task_struct *p)
 {
-	sched_core_put_cookie(p->core_cookie);
+	if (!sched_core_disabled())
+		sched_core_put_cookie(p->core_cookie);
 }
 
 static void __sched_core_set(struct task_struct *p, unsigned long cookie)
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ