[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <xhsmhpldse79l.mognet@vschneid-thinkpadt14sgen2i.remote.csb>
Date: Tue, 22 Jul 2025 14:31:50 +0200
From: Valentin Schneider <vschneid@...hat.com>
To: Huang Shijie <shijie@...amperecomputing.com>, mingo@...hat.com,
peterz@...radead.org, juri.lelli@...hat.com, vincent.guittot@...aro.org
Cc: patches@...erecomputing.com, cl@...ux.com,
Shubhang@...amperecomputing.com, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
linux-kernel@...r.kernel.org, Huang Shijie <shijie@...amperecomputing.com>
Subject: Re: [PATCH v5] sched/fair: do not scan twice in detach_tasks()
On 22/07/25 18:26, Huang Shijie wrote:
> detach_tasks() uses struct lb_env.loop_max as an env.src_rq->cfs_tasks
> iteration count limit. It is however set without the source RQ lock held.
>
> This means that env.loop_max and the actual length of env.src_rq->cfs_tasks
> as observed within detach_tasks() can differ. This can cause some tasks to
> be unnecessarily iterated over more than once, for instance:
>
> env.loop_max := 4
> detach_tasks()
> // Here env.src->cfs_tasks only contains two tasks which can't be
> // migrated anywhere, so they're put back in the list each time.
> env.src->cfs_tasks := [p1, p0]
> // The iteration goes:
> p0; cfs_tasks := [p0, p1]
> p1; cfs_tasks := [p1, p0]
> p0; cfs_tasks := [p0, p1]
> p1; cfs_tasks := [p1, p0]
>
> // IOW we iterate over each task twice
>
> In the Specjbb test, the similar issues can be caught many times.
> (Over 330,000 times in a 30-minites Specjbb test)
>
> This patch sets env.loop_max only once RQ lock is taken,
> and uses busiest->cfs.h_nr_queued for setting the env.loop_max.
>
> After this patch, I cannot catch any above issue in the Specjbb test.
>
> Signed-off-by: Huang Shijie <shijie@...amperecomputing.com>
Reviewed-by: Valentin Schneider <vschneid@...hat.com>
Powered by blists - more mailing lists