mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mete Durlu <meted@linux.ibm.com>
To: Zhan Xusheng <zhanxusheng1024@gmail.com>
Cc: Zhan Xusheng <zhanxusheng@xiaomi.com>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	Zhan Xusheng <zhanxusheng@xiaom.com>,
	Ilya Leoshkevich <iii@linux.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/fair: Make is_core_idle() check all cpus in a core
Date: Sun, 9 Aug 2026 12:02:51 +0200	[thread overview]
Message-ID: <986cef14-f6fd-48b3-843c-d2098527150f@linux.ibm.com> (raw)
In-Reply-To: <20260807034211.1148245-1-zhanxusheng@xiaomi.com>

Hi,

> The skip is what lets a caller ask this from a CPU that is about to become
> idle, where idle_cpu() cannot be true yet.
> 
> sched_balance_newidle() calls
> 
> 	sched_balance_rq(this_cpu, this_rq, sd, CPU_NEWLY_IDLE, ...)
> 
> so env->dst_cpu is this_cpu, and we are inside __schedule() with rq->curr
> still the outgoing task.  idle_rq() wants rq->curr == rq->idle, so
> idle_cpu(this_cpu) is false.  __CPU_NOT_IDLE is 0, so the env->idle test in
> update_sg_lb_stats() does not filter CPU_NEWLY_IDLE out either.  For every
> newidle balance the patch therefore gives:
> 
>    env->dst_core_idle	false, so the misfit gate in
> 			update_sd_pick_busiest() stops pulling
>    sched_use_asym_prio()	false, so asym packing no longer applies
> 
> s390 cannot show that: SD_ASYM_PACKING is set only by powerpc and x86 ITMT,
> SD_ASYM_CPUCAPACITY only by arm64 big.LITTLE and x86 hybrid.

Thank you for the detailed explanation. I totally overlooked the
CPU_NEWLY_IDLE case.

> The other callers -- numa_idle_core(), select_idle_capacity(),
> asym_fits_cpu(), should_we_balance() -- all establish idle_cpu(cpu) first,
> so there this only adds a redundant idle_cpu() per candidate, two of them
> on the wakeup path.

I thought idle_cpu() is a cheap call to make and an extra one wouldn't
make a difference.

> Since the complaint is really the name, would renaming it do the job
> without touching behaviour?  asym_fits_cpu() already words it as "the core
> has no busy siblings", and sched_use_asym_prio()'s kernel-doc treats @cpu's
> idleness as the caller's precondition.

Right, a rename sounds like a better option to me now. I'll send a new
version.

> dst_core_idle may well want whole-core semantics as its comment says, but
> that reads like a separate patch with numbers from an asymmetric-capacity
> machine.

I suppose after the rename, the code block would represent what is
being done more clearly and cause more people to raise their
eyebrows. Maybe then we get some measurements :)

Thanks!

      reply	other threads:[~2026-08-09 10:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06 18:18 Mete Durlu
2026-08-07  3:42 ` Zhan Xusheng
2026-08-09 10:02   ` Mete Durlu [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=986cef14-f6fd-48b3-843c-d2098527150f@linux.ibm.com \
    --to=meted@linux.ibm.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=iii@linux.ibm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=zhanxusheng1024@gmail.com \
    --cc=zhanxusheng@xiaom.com \
    --cc=zhanxusheng@xiaomi.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 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®