mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Abel Wu <wuyun.abel@bytedance.com>
To: Peter Zijlstra <peterz@infradead.org>, Mel Gorman <mgorman@suse.de>
Cc: Vincent Guittot <vincent.guittot@linaro.org>,
	Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/fair: Fix misuse of available_idle_cpu()
Date: Tue, 20 Sep 2022 15:42:51 +0800	[thread overview]
Message-ID: <6bbd4f4d-d64c-0c9d-90d5-9122e6b21835@bytedance.com> (raw)
In-Reply-To: <b3d2c694-e2a2-63ea-817f-113b5445dfda@bytedance.com>

Ping :)

On 9/8/22 9:49 PM, Abel Wu wrote:
> On 9/8/22 9:17 PM, Peter Zijlstra wrote:
>> On Thu, Sep 08, 2022 at 11:36:32AM +0100, Mel Gorman wrote:
>>> On Thu, Sep 08, 2022 at 04:07:02PM +0800, Abel Wu wrote:
>>>> The function available_idle_cpu() was introduced to distinguish
>>>> between the code paths that cares if the vCPU is preempted and
>>>> the ones don't care. In general, available_idle_cpu() is used in
>>>> selecting cpus for immediate use, e.g. ttwu. While idle_cpu() is
>>>> used in the paths that only cares about the cpu is idle or not,
>>>> and __update_idle_core() is one of them.
>>>>
>>>> Use idle_cpu() instead in the idle path to make has_idle_core
>>>> a better hint.
>>>>
>>>> Fixes: 943d355d7fee (sched/core: Distinguish between idle_cpu() 
>>>> calls based on desired effect, introduce available_idle_cpu())
>>>> Signed-off-by: Abel Wu <wuyun.abel@bytedance.com>
>>>
>>> Seems fair. As vCPU preemption is specific to virtualisation, it is very
>>> unlikely that SMT is exposed to the guest so the impact of the patch is
>>
>> Right; only pinned guests typically expose such topology information
>> (anything else would be quite broken).

Yes, and it is common in our ECS servers to use pinned guests.

>>
>>> minimal but I still think it's right so;
>>
>> I'm not convinced; all of select_idle_sibling() seems to use
>> available_idle_cpu(), and that's the only consumer of
>> __update_idle_core(), so in that respect the current state makes sense.
> 
> Hi Peter, Mel, thanks for your reviewing!
> 
> My thought was that the preempted core can become active again before
> select_idle_sibling() is called, so using available_idle_cpu() in
> __update_idle_core() can potentially lose the opportunity to kick an
> idle core running. While the downside of using idle_cpu() is that a
> full scan can be triggered irrespective of non-preempted cores exist,
> but even available_idle_cpu() can not make sure of that either.
> 
> BTW, I am also confused with select_idle_core() in which all the cpus
> of a core need to be non-preempted before the core can be taken as an
> idle core. IMHO, it might be enough that at least one cpu of an idle
> core is non-preempted and allowed by task's taskset.

      reply	other threads:[~2022-09-20  7:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08  8:07 Abel Wu
2022-09-08 10:36 ` Mel Gorman
2022-09-08 13:17   ` Peter Zijlstra
2022-09-08 13:49     ` Abel Wu
2022-09-20  7:42       ` Abel Wu [this message]

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=6bbd4f4d-d64c-0c9d-90d5-9122e6b21835@bytedance.com \
    --to=wuyun.abel@bytedance.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®