Skip to contentSkip to conversation

sched/core: remove unnecessary unlikely() in push_xx_task

PATCH In review Yangtao Li 2 participants 3 messages Nov 3, 2018 – Dec 11, 2018 Scheduler

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/1 sched/core: remove unnecessary unlikely() in push_xx_task

WARN_ON() already contains an unlikely(), so it's not necessary to use WARN_ON(1).

---
 kernel/sched/deadline.c | 4 +---
 kernel/sched/rt.c       | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
kernel/sched/deadline.c +1 -3
index 91e4202b0634..8b5d964d59c5 100644
@@ -2041,10 +2041,8 @@ static int push_dl_task(struct rq *rq)
 		return 0;
 
 retry:
-	if (unlikely(next_task == rq->curr)) {
-		WARN_ON(1);
+	if (WARN_ON(next_task == rq->curr))
 		return 0;
-	}
 
 	/*
 	 * If next_task preempts rq->curr, and rq->curr
kernel/sched/rt.c +1 -3
index 2e2955a8cf8f..0efd58563c80 100644
@@ -1810,10 +1810,8 @@ static int push_rt_task(struct rq *rq)
 		return 0;
 
 retry:
-	if (unlikely(next_task == rq->curr)) {
-		WARN_ON(1);
+	if (WARN_ON(next_task == rq->curr))
 		return 0;
-	}
 
 	/*
 	 * It's possible that the next_task slipped in of
Signature · 1 line
2.17.0
author
#1 lore raw

Hi mingo:
What is your point of view?
--Yangtao

Quoted 45 lines · Yangtao Li

WARN_ON() already contains an unlikely(), so it's not necessary to use WARN_ON(1).

---
 kernel/sched/deadline.c | 4 +---
 kernel/sched/rt.c       | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
kernel/sched/deadline.c +1 -3
index 91e4202b0634..8b5d964d59c5 100644
@@ -2041,10 +2041,8 @@ static int push_dl_task(struct rq *rq)
                return 0;
 
 retry:
-       if (unlikely(next_task == rq->curr)) {
-               WARN_ON(1);
+       if (WARN_ON(next_task == rq->curr))
                return 0;
-       }
 
        /*
         * If next_task preempts rq->curr, and rq->curr
kernel/sched/rt.c +1 -4
index 2e2955a8cf8f..0efd58563c80 100644
@@ -1810,10 +1810,8 @@ static int push_rt_task(struct rq *rq)
                return 0;
 
 retry:
-       if (unlikely(next_task == rq->curr)) {
-               WARN_ON(1);
+       if (WARN_ON(next_task == rq->curr))
                return 0;
-       }
 
        /*
         * It's possible that the next_task slipped in of
--

2.17.0

#2 lore raw

[tip:sched/core] sched/core: Remove unnecessary unlikely() in push_*_task()

In reply to Yangtao Li
sched/core: Remove unnecessary unlikely() in push_*_task()
Commit-ID:  9ebc6053814d37b9de8cc291fba28f30a729c929
Gitweb:     https://git.kernel.org/tip/9ebc6053814d37b9de8cc291fba28f30a729c929
Author:     Yangtao Li <[email protected]>
AuthorDate: Sat, 3 Nov 2018 13:26:02 -0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 11 Dec 2018 15:16:57 +0100

sched/core: Remove unnecessary unlikely() in push_*_task()

WARN_ON() already contains an unlikely(), so it's not necessary to use WARN_ON(1).

---
 kernel/sched/deadline.c | 4 +---
 kernel/sched/rt.c       | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
kernel/sched/deadline.c +1 -3
index b32bc1f7cd14..fb8b7b5d745d 100644
@@ -2042,10 +2042,8 @@ static int push_dl_task(struct rq *rq)
 		return 0;
 
 retry:
-	if (unlikely(next_task == rq->curr)) {
-		WARN_ON(1);
+	if (WARN_ON(next_task == rq->curr))
 		return 0;
-	}
 
 	/*
 	 * If next_task preempts rq->curr, and rq->curr
kernel/sched/rt.c +1 -3
index 9aa3287ce301..e4f398ad9e73 100644
@@ -1813,10 +1813,8 @@ static int push_rt_task(struct rq *rq)
 		return 0;
 
 retry:
-	if (unlikely(next_task == rq->curr)) {
-		WARN_ON(1);
+	if (WARN_ON(next_task == rq->curr))
 		return 0;
-	}
 
 	/*
 	 * It's possible that the next_task slipped in of