[PATCH v2] sched/core: Remove unnecessary check for next_task in push_{rt,dl}_task()

2018-11-03 Thread Muchun Song
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));
  }

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 
---
Changes in v2:
  -also remove unnecessary check in deadline.c
  -update commit message
---
 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 481bb7aa25c5..ec097edea9ca 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1813,11 +1813,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



[PATCH v2] sched/core: Remove unnecessary check for next_task in push_{rt,dl}_task()

2018-11-03 Thread Muchun Song
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));
  }

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 
---
Changes in v2:
  -also remove unnecessary check in deadline.c
  -update commit message
---
 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 481bb7aa25c5..ec097edea9ca 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1813,11 +1813,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