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  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]
Date:   Thu,  7 Jan 2021 09:57:26 +0800
From:   qianjun.kernel@...il.com
To:     mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
        vincent.guittot@...aro.org, linux-kernel@...r.kernel.org
Cc:     jun qian <qianjun.kernel@...il.com>
Subject: [PATCH 1/1] sched/fair:Avoid unnecessary assignment to cfs_rq->on_list

From: jun qian <qianjun.kernel@...il.com>

Obviously, cfs_rq->on_list is already equal to 1 when cfs_rq->on_list
is assigned a value of 1, so an else branch is needed to avoid unnecessary
assignment operations.

Signed-off-by: jun qian <qianjun.kernel@...il.com>
---
 kernel/sched/fair.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 04a3ce20da67..ef6ebd95443d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -305,8 +305,8 @@ static inline bool list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
 
 	if (cfs_rq->on_list)
 		return rq->tmp_alone_branch == &rq->leaf_cfs_rq_list;
-
-	cfs_rq->on_list = 1;
+	else
+		cfs_rq->on_list = 1;
 
 	/*
 	 * Ensure we either appear before our parent (if already
-- 
2.18.2

Powered by blists - more mailing lists