sched/fair.c: add helper func for util_avg and runnable_avg calc
PATCH 1/1 sched/fair.c: add helper func for util_avg and runnable_avg calc
add helper func for util_avg and runnable_avg calc when entity enqueue and dequeue. No functional change.
without this change:
size vmlinux
text data bss dec hex filename
19889268 6632812 2429160 28951240 1b9c2c8 vmlinux
size kernel/sched/fair.o
text data bss dec hex filename
40044 1569 96 41709 a2ed kernel/sched/fair.o
ubuntu@zeku_server:~/workspace/linux-stable $
with this change:
size vmlinux
text data bss dec hex filename
19889268 6632812 2429160 28951240 1b9c2c8 vmlinux
size kernel/sched/fair.o
text data bss dec hex filename
40044 1569 96 41709 a2ed kernel/sched/fair.o
--- kernel/sched/fair.c | 48 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-)
kernel/sched/fair.c +40 -8
@@ -3068,11 +3068,47 @@ dequeue_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se)sub_positive (&cfs_rq->avg.load_avg, se->avg.load_avg);sub_positive (&cfs_rq->avg.load_sum,se_weight (se) * se->avg.load_sum); } + +static inline void +enqueue_util_avg (struct cfs_rq *cfs_rq,struct sched_entity *se) +{ + cfs_rq->avg.util_avg += se->avg.util_avg; + cfs_rq->avg.util_sum += se->avg.util_sum; +} + +static inline void +dequeue_util_avg (struct cfs_rq *cfs_rq,struct sched_entity *se) +{ +sub_positive (&cfs_rq->avg.util_avg, se->avg.util_avg); +sub_positive (&cfs_rq->avg.util_sum, se->avg.util_sum); +} + +static inline void +enqueue_runnable_avg (struct cfs_rq *cfs_rq,struct sched_entity *se) +{ + cfs_rq->avg.runnable_avg += se->avg.runnable_avg; + cfs_rq->avg.runnable_sum += se->avg.runnable_sum; +} + +static inline void +dequeue_runnable_avg (struct cfs_rq *cfs_rq,struct sched_entity *se) +{ +sub_positive (&cfs_rq->avg.runnable_avg, se->avg.runnable_avg); +sub_positive (&cfs_rq->avg.runnable_sum, se->avg.runnable_sum); +}#else static inline void enqueue_load_avg (struct cfs_rq *cfs_rq,struct sched_entity *se) { }static inline void dequeue_load_avg (struct cfs_rq *cfs_rq,struct sched_entity *se) { } +static inline void +enqueue_util_avg (struct cfs_rq *cfs_rq,struct sched_entity *se) { } +static inline void +dequeue_util_avg (struct cfs_rq *cfs_rq,struct sched_entity *se) { } +static inline void +enqueue_runnable_avg (struct cfs_rq *cfs_rq,struct sched_entity *se) { } +static inline void +dequeue_runnable_avg (struct cfs_rq *cfs_rq,struct sched_entity *se) { }#endif static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
@@ -3729,10 +3765,8 @@ static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s }enqueue_load_avg (cfs_rq, se); - cfs_rq->avg.util_avg += se->avg.util_avg; - cfs_rq->avg.util_sum += se->avg.util_sum; - cfs_rq->avg.runnable_avg += se->avg.runnable_avg; - cfs_rq->avg.runnable_sum += se->avg.runnable_sum; +enqueue_util_avg (cfs_rq, se); +enqueue_runnable_avg (cfs_rq, se);add_tg_cfs_propagate (cfs_rq, se->avg.load_sum);
@@ -3752,10 +3786,8 @@ static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *sstatic void detach_entity_load_avg (struct cfs_rq *cfs_rq,struct sched_entity *se) {dequeue_load_avg (cfs_rq, se); -sub_positive (&cfs_rq->avg.util_avg, se->avg.util_avg); -sub_positive (&cfs_rq->avg.util_sum, se->avg.util_sum); -sub_positive (&cfs_rq->avg.runnable_avg, se->avg.runnable_avg); -sub_positive (&cfs_rq->avg.runnable_sum, se->avg.runnable_sum); +dequeue_util_avg (cfs_rq, se); +dequeue_runnable_avg (cfs_rq, se);add_tg_cfs_propagate (cfs_rq, -se->avg.load_sum);
Signature · 1 line
2.25.1
Peter Zijlstra
maintainerQuoted 20 lines · Hui Su
add helper func for
util_avgandrunnable_avgcalc when entity enqueue and dequeue. No functional change.without this change:
size vmlinux
text data bss dec hex filename
19889268 6632812 2429160 28951240 1b9c2c8 vmlinux
sizekernel/sched/fair.o
text data bss dec hex filename
40044 1569 96 41709 a2edkernel/sched/fair.o
ubuntu@zeku_server:~/workspace/linux-stable $with this change:
size vmlinux
text data bss dec hex filename
19889268 6632812 2429160 28951240 1b9c2c8 vmlinux
sizekernel/sched/fair.o
text data bss dec hex filename
40044 1569 96 41709 a2edkernel/sched/fair.o
Quoted 4 lines
Signed-off-by Hui Su <[email protected]>--- kernel/sched/fair.c | 48 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-)
So you're increasing line-count and clutter for absolutely no benefit.
Why would we want that?