diff options
author | Peter Zijlstra <peterz@infradead.org> | 2021-05-12 13:32:37 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2021-05-18 12:53:53 +0200 |
commit | 90a0ff4ec9c65cae3085d23301933172cea3f38a (patch) | |
tree | aa34607bd42bf125622d5f078f2eacf39eabc757 /kernel/sched/stats.h | |
parent | sched/isolation: Reconcile rcu_nocbs= and nohz_full= (diff) | |
download | linux-90a0ff4ec9c65cae3085d23301933172cea3f38a.tar.xz linux-90a0ff4ec9c65cae3085d23301933172cea3f38a.zip |
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>
Diffstat (limited to 'kernel/sched/stats.h')
-rw-r--r-- | kernel/sched/stats.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/kernel/sched/stats.h b/kernel/sched/stats.h index 33ffd41935ba..111072ee9663 100644 --- a/kernel/sched/stats.h +++ b/kernel/sched/stats.h @@ -160,10 +160,11 @@ static inline void sched_info_dequeue(struct rq *rq, struct task_struct *t) { unsigned long long delta = 0; - if (t->sched_info.last_queued) { - delta = rq_clock(rq) - t->sched_info.last_queued; - t->sched_info.last_queued = 0; - } + if (!t->sched_info.last_queued) + return; + + delta = rq_clock(rq) - t->sched_info.last_queued; + t->sched_info.last_queued = 0; t->sched_info.run_delay += 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) { - unsigned long long now = rq_clock(rq), delta = 0; + unsigned long long now, delta = 0; - if (t->sched_info.last_queued) { - delta = now - t->sched_info.last_queued; - t->sched_info.last_queued = 0; - } + if (!t->sched_info.last_queued) + return; + + 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.last_arrival = now; t->sched_info.pcount++; |