public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: qianjun.kernel@gmail.com
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, linux-kernel@vger.kernel.org
Cc: jun qian <qianjun.kernel@gmail.com>
Subject: [PATCH 1/1] sched/fair:Avoid unnecessary assignment to cfs_rq->on_list
Date: Thu,  7 Jan 2021 09:57:26 +0800	[thread overview]
Message-ID: <20210107015726.54362-1-qianjun.kernel@gmail.com> (raw)

From: jun qian <qianjun.kernel@gmail.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@gmail.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


             reply	other threads:[~2021-01-07  1:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07  1:57 qianjun.kernel [this message]
2021-01-07  8:27 ` [PATCH 1/1] sched/fair:Avoid unnecessary assignment to cfs_rq->on_list Vincent Guittot

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=20210107015726.54362-1-qianjun.kernel@gmail.com \
    --to=qianjun.kernel@gmail.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.org \
    /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