sched/stats: Fix unlikely() use of sched_info_on()

sched_info_on() is called with unlikely hint, however, the test
is to be a constant(1) on which compiler will do nothing when
make defconfig, so remove the hint.

Also, fix a lack of {}.

Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: up2wing@gmail.com
Cc: wang.liang82@zte.com.cn
Cc: xue.zhihong@zte.com.cn
Link: https://lkml.kernel.org/r/1562301307-43002-1-git-send-email-wang.yi59@zte.com.cn
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Yi Wang 2019-07-05 12:35:07 +08:00 committed by Ingo Molnar
parent 7b3c92b85a
commit 65d74e9169

View File

@ -157,9 +157,10 @@ static inline void sched_info_dequeued(struct rq *rq, struct task_struct *t)
{ {
unsigned long long now = rq_clock(rq), delta = 0; unsigned long long now = rq_clock(rq), delta = 0;
if (unlikely(sched_info_on())) if (sched_info_on()) {
if (t->sched_info.last_queued) if (t->sched_info.last_queued)
delta = now - t->sched_info.last_queued; delta = now - t->sched_info.last_queued;
}
sched_info_reset_dequeued(t); sched_info_reset_dequeued(t);
t->sched_info.run_delay += delta; t->sched_info.run_delay += delta;
@ -192,7 +193,7 @@ static void sched_info_arrive(struct rq *rq, struct task_struct *t)
*/ */
static inline void sched_info_queued(struct rq *rq, struct task_struct *t) static inline void sched_info_queued(struct rq *rq, struct task_struct *t)
{ {
if (unlikely(sched_info_on())) { if (sched_info_on()) {
if (!t->sched_info.last_queued) if (!t->sched_info.last_queued)
t->sched_info.last_queued = rq_clock(rq); t->sched_info.last_queued = rq_clock(rq);
} }
@ -239,7 +240,7 @@ __sched_info_switch(struct rq *rq, struct task_struct *prev, struct task_struct
static inline void static inline void
sched_info_switch(struct rq *rq, struct task_struct *prev, struct task_struct *next) sched_info_switch(struct rq *rq, struct task_struct *prev, struct task_struct *next)
{ {
if (unlikely(sched_info_on())) if (sched_info_on())
__sched_info_switch(rq, prev, next); __sched_info_switch(rq, prev, next);
} }