Re: [RFC PATCH] sched/fair: Choose the CPU where short task is running during wake up
From: Chen Yu
Date: Sat Sep 17 2022 - 10:15:54 EST
On 2022-09-16 at 13:47:49 +0200, Peter Zijlstra wrote:
> On Fri, Sep 16, 2022 at 12:54:07AM +0800, Chen Yu wrote:
>
> > Current proposal is a variant of 2:
> > If the target CPU is running a short-time slice task, and the wakee
> > is also a short-time slice task, the target CPU could be chosen as the
> > candidate when the system is busy.
>
> Since this benchmark only has short running tasks, the result is that
> you always pick the local cpu and therefore the migrations are reduced?
>
Yes, local cpu is preferred.
> Doesn't this inhibit spreading the workload when there's geniunely idle
> CPUs around?
Yes, there could be some idle CPUs undetected, although this strategy is
in effect when the system is busy. And maybe we could raise the bar to
enable this strategy. For example as Tim mentioned, if the target CPU is
running a short-running task, and the nr_running is 1, meanwhile there's no
ttwu_pending flag on this CPU, we can choose the target. I don't have
good idea on how to extract the criterias to descibe the scenario, for
example, how to detect if the sched_domain has too many context switch and
we can safely inhibit spreading the workload.
thanks,
Chenyu