Messages in this thread | | | Date | Fri, 2 Jun 2023 16:27:39 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH 01/15] sched/fair: Add avg_vruntime |
| |
On Fri, Jun 02, 2023 at 03:51:53PM +0200, Vincent Guittot wrote: > On Wed, 31 May 2023 at 14:47, Peter Zijlstra <peterz@infradead.org> wrote: > > +static void > > +avg_vruntime_add(struct cfs_rq *cfs_rq, struct sched_entity *se) > > +{ > > + unsigned long weight = scale_load_down(se->load.weight); > > + s64 key = entity_key(cfs_rq, se); > > + > > + cfs_rq->avg_vruntime += key * weight; > > + cfs_rq->avg_load += weight; > > isn't cfs_rq->avg_load similar to scale_load_down(cfs_rq->load.weight) ? > > > +}
Similar, yes, but not quite the same in two ways:
- it's sometimes off by one entry due to ordering of operations -- this is probably fixable.
- it does the scale down after addition, whereas this does the scale down before addition, esp for multiple low weight entries this makes a significant difference.
| |