sched,stats: Further simplify sched_info

There's no point doing delta==0 updates.

Suggested-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
This commit is contained in:
Peter Zijlstra 2021-05-12 13:32:37 +02:00
Родитель 915a2bc3c6
Коммит 90a0ff4ec9
1 изменённых файлов: 12 добавлений и 9 удалений

Просмотреть файл

@ -160,10 +160,11 @@ static inline void sched_info_dequeue(struct rq *rq, struct task_struct *t)
{ {
unsigned long long delta = 0; unsigned long long delta = 0;
if (t->sched_info.last_queued) { if (!t->sched_info.last_queued)
delta = rq_clock(rq) - t->sched_info.last_queued; return;
t->sched_info.last_queued = 0;
} delta = rq_clock(rq) - t->sched_info.last_queued;
t->sched_info.last_queued = 0;
t->sched_info.run_delay += delta; t->sched_info.run_delay += delta;
rq_sched_info_dequeue(rq, delta); rq_sched_info_dequeue(rq, delta);
@ -176,12 +177,14 @@ static inline void sched_info_dequeue(struct rq *rq, struct task_struct *t)
*/ */
static void sched_info_arrive(struct rq *rq, struct task_struct *t) static void sched_info_arrive(struct rq *rq, struct task_struct *t)
{ {
unsigned long long now = rq_clock(rq), delta = 0; unsigned long long now, delta = 0;
if (t->sched_info.last_queued) { if (!t->sched_info.last_queued)
delta = now - t->sched_info.last_queued; return;
t->sched_info.last_queued = 0;
} now = rq_clock(rq);
delta = now - t->sched_info.last_queued;
t->sched_info.last_queued = 0;
t->sched_info.run_delay += delta; t->sched_info.run_delay += delta;
t->sched_info.last_arrival = now; t->sched_info.last_arrival = now;
t->sched_info.pcount++; t->sched_info.pcount++;