[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z3-iroUxuM7DwqKu@vaxr-BM6660-BM6360>
Date: Thu, 9 Jan 2025 18:19:26 +0800
From: I Hsin Cheng <richard120310@...il.com>
To: "Nysal Jan K.A." <nysal@...ux.ibm.com>
Cc: peterz@...radead.org, juri.lelli@...hat.com, mingo@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
vschneid@...hat.com, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH] sched/fair: Refactor can_migrate_task() to elimate
looping
On Thu, Jan 09, 2025 at 02:28:27PM +0530, Nysal Jan K.A. wrote:
> On Thu, Jan 09, 2025 at 01:29:47AM +0800, I Hsin Cheng wrote:
> > @@ -9404,12 +9404,16 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env)
> > return 0;
> >
> > /* Prevent to re-select dst_cpu via env's CPUs: */
> > - for_each_cpu_and(cpu, env->dst_grpmask, env->cpus) {
> > - if (cpumask_test_cpu(cpu, p->cpus_ptr)) {
> > - env->flags |= LBF_DST_PINNED;
> > - env->new_dst_cpu = cpu;
> > - break;
> > - }
> > + struct cpumask dst_mask;
> > +
> > + cpumask_and(&dst_mask, env->dst_grpmask, env->cpus);
> > + cpumask_and(&dst_mask, &dst_mask, p->cpus_ptr);
> > +
> > + cpu = cpumask_first(&dst_mask);
>
> Can cpumask_first_and_and() be used instead?
>
> > +
> > + if (cpu < nr_cpu_ids) {
> > + env->flags |= LBF_DST_PINNED;
> > + env->new_dst_cpu = cpu;
> > }
> >
> > return 0;
> > --
> > 2.43.0
> >
>
> --Nysal
> Can cpumask_first_and_and() be used instead?
That's a great idea! thank you.
That way we don't have to put redundant cpumask on stack, I'll test it
real soon and send the test result up.
--Richard
Powered by blists - more mailing lists