[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220331114709.GS8939@worktop.programming.kicks-ass.net>
Date: Thu, 31 Mar 2022 13:47:09 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Vincent Guittot <vincent.guittot@...aro.org>
Cc: Tim Chen <tim.c.chen@...ux.intel.com>, Ingo Molnar <mingo@...e.hu>,
Juri Lelli <juri.lelli@...hat.com>,
Yu Chen <yu.c.chen@...el.com>,
Walter Mack <walter.mack@...el.com>,
Mel Gorman <mgorman@...e.de>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] sched/fair: Simple runqueue order on migrate
It's been 3 months since I wrote these patches, so memory is vague at
best :/
On Tue, Mar 29, 2022 at 11:03:44AM +0200, Vincent Guittot wrote:
> > +static void place_entity_migrate(struct cfs_rq *cfs_rq, struct sched_entity *se)
> > +{
> > + if (!sched_feat(PLACE_MIGRATE))
> > + return;
> > +
> > + if (cfs_rq->nr_running < se->migrated) {
> > + /*
> > + * Migrated to a shorter runqueue, go first because
> > + * we were under-served on the old runqueue.
> > + */
> > + se->vruntime = cfs_rq->min_vruntime;
> > + return;
> > + }
> > +
> > + /*
> > + * Migrated to a longer runqueue, go last because
> > + * we got over-served on the old runqueue.
> > + */
> > + se->vruntime = cfs_rq->min_vruntime + sched_vslice(cfs_rq, se);
> > +}
> > +
> > static void check_enqueue_throttle(struct cfs_rq *cfs_rq);
> >
> > static inline bool cfs_bandwidth_used(void);
> > @@ -4296,6 +4317,8 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
> >
> > if (flags & ENQUEUE_WAKEUP)
> > place_entity(cfs_rq, se, 0);
> > + else if (se->migrated)
> > + place_entity_migrate(cfs_rq, se);
> >
> > check_schedstat_required();
> > update_stats_enqueue_fair(cfs_rq, se, flags);
> > @@ -6973,14 +6997,15 @@ static void migrate_task_rq_fair(struct task_struct *p, int new_cpu)
> > * wakee task is less decayed, but giving the wakee more load
> > * sounds not bad.
> > */
> > - remove_entity_load_avg(&p->se);
> > + remove_entity_load_avg(se);
> > }
> >
> > /* Tell new CPU we are migrated */
> > - p->se.avg.last_update_time = 0;
> > + se->avg.last_update_time = 0;
> >
> > /* We have migrated, no longer consider this task hot */
> > - p->se.migrated = 1;
> > + for_each_sched_entity(se)
> > + se->migrated = READ_ONCE(cfs_rq_of(se)->nr_running) + !se->on_rq;
>
> Why do we need to loop on se ? Isn't p->se enough ?
Yeah; I really don't recall why I did that. And looking at it now, it
doesn't really make much sense. I suppose it will trigger
place_entity_migrate() for the group entries, but on the old CPU.
Powered by blists - more mailing lists