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 RESEND v2] sched/core: Remove unnecessary check for next_task in push_{rt,dl}_task()
Date: Mon, 26 Nov 2018 22:21:16 +0800	[thread overview]
Message-ID: <20181126142116.5593-1-smuchun@gmail.com> (raw)

In push_{rt,dl}_task(), we call pick_next_pushable{_dl}_task() to
pick next_task before the check. If next_task and rq->curr are equal,
which will trigger BUG_ON() in pick_next_pushable{_dl}_task(). See
the following code in pick_next_pushable{_dl}_task().

  static struct task_struct *pick_next_pushable{_dl}_task(struct rq *rq)
  {
	BUG_ON(task_current(rq, p));

	return p;
  }

The task_current() will check if task p and rq->curr are equal.
So, we can remove the unnecessary check in push_{rt,dl}_task().

Signed-off-by: Muchun Song <smuchun@gmail.com>
---
 kernel/sched/deadline.c | 5 -----
 kernel/sched/rt.c       | 5 -----
 2 files changed, 10 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 470ba6b464fe..4b0189627318 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -2042,11 +2042,6 @@ static int push_dl_task(struct rq *rq)
 		return 0;
 
 retry:
-	if (unlikely(next_task == rq->curr)) {
-		WARN_ON(1);
-		return 0;
-	}
-
 	/*
 	 * If next_task preempts rq->curr, and rq->curr
 	 * can move away, it makes sense to just reschedule
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index f28157c8212b..efc3fbe205ac 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1824,11 +1824,6 @@ static int push_rt_task(struct rq *rq)
 		return 0;
 
 retry:
-	if (unlikely(next_task == rq->curr)) {
-		WARN_ON(1);
-		return 0;
-	}
-
 	/*
 	 * It's possible that the next_task slipped in of
 	 * higher priority than current. If that's the case
-- 
2.17.1


                 reply	other threads:[~2018-11-26 14:21 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=20181126142116.5593-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).