linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Muchun Song <smuchun@gmail.com>
To: mingo@kernel.org, peterz@infradead.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] sched/rt: Add a check for calling update_curr_rt()
Date: Tue,  6 Nov 2018 23:57:31 +0800	[thread overview]
Message-ID: <20181106155731.32528-1-smuchun@gmail.com> (raw)

We may dequeue prev's rt_rq in put_prev_task() only when RT
bandwidth is enabled. If RT bandwidth is disabled, it is
unnecessary for us to call update_curr_rt(). So we add a check
there.

Signed-off-by: Muchun Song <smuchun@gmail.com>
---
 kernel/sched/rt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 9aa3287ce301..7761a75d9b87 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1564,10 +1564,11 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
 	}
 
 	/*
-	 * We may dequeue prev's rt_rq in put_prev_task().
-	 * So, we update time before rt_queued check.
+	 * We may dequeue prev's rt_rq in put_prev_task()
+	 * only when RT bandwidth is enabled. So, we
+	 * update time before rt_queued check.
 	 */
-	if (prev->sched_class == &rt_sched_class)
+	if (rt_bandwidth_enabled() && prev->sched_class == &rt_sched_class)
 		update_curr_rt(rq);
 
 	if (!rt_rq->rt_queued)
-- 
2.17.1


                 reply	other threads:[~2018-11-06 15:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20181106155731.32528-1-smuchun@gmail.com \
    --to=smuchun@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).