All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Tim Chen <tim.c.chen@linux.intel.com>,
	Ingo Molnar <mingo@elte.hu>, Juri Lelli <juri.lelli@redhat.com>,
	Yu Chen <yu.c.chen@intel.com>,
	Walter Mack <walter.mack@intel.com>, Mel Gorman <mgorman@suse.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] sched/fair: Simple runqueue order on migrate
Date: Thu, 31 Mar 2022 13:47:09 +0200	[thread overview]
Message-ID: <20220331114709.GS8939@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <CAKfTPtBDA1uZ1xvo_uhqnNVg69DPXXJBeo0+aQdVJiosB_qgrw@mail.gmail.com>


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.



  reply	other threads:[~2022-03-31 11:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25 22:54 [PATCH 0/2] sched/fair: Fix starvation caused by task migration Tim Chen
2022-03-25 22:54 ` [PATCH 1/2] sched/fair: Don't rely on ->exec_start for migration Tim Chen
2022-03-25 22:54 ` [PATCH 2/2] sched/fair: Simple runqueue order on migrate Tim Chen
2022-03-29  9:03   ` Vincent Guittot
2022-03-31 11:47     ` Peter Zijlstra [this message]
2022-03-31 12:15       ` Vincent Guittot
2022-03-29 10:09   ` Abel Wu
2022-03-29 14:26     ` Tim Chen
2022-03-30  9:46   ` [sched/fair] ddb3b1126f: hackbench.throughput -25.9% regression kernel test robot
2022-03-30  9:46     ` kernel test robot
2022-03-30 23:48     ` Tim Chen
2022-03-30 23:48       ` Tim Chen
2022-04-01 18:04       ` Chen Yu
2022-04-01 18:04         ` Chen Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220331114709.GS8939@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@elte.hu \
    --cc=tim.c.chen@linux.intel.com \
    --cc=vincent.guittot@linaro.org \
    --cc=walter.mack@intel.com \
    --cc=yu.c.chen@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.