mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhan Xusheng <zhanxusheng1024@gmail.com>
To: Mete Durlu <meted@linux.ibm.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: Fri,  7 Aug 2026 11:42:11 +0800	[thread overview]
Message-ID: <20260807034211.1148245-1-zhanxusheng@xiaomi.com> (raw)
In-Reply-To: <20260806-fix_is_core_idle-v1-1-605119e55b25@linux.ibm.com>

On Thu, 06 Aug 2026 20:18:56 +0200, Mete Durlu wrote:
> Fix this by removing the check that skips the passed CPU when evaluating
> idle_cpu(), ensuring is_core_idle() now correctly determines if the entire
> core (including the passed CPU) is idle.

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.

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.

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.

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.

Thanks,
Zhan Xusheng

  reply	other threads:[~2026-08-07  3:42 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 [this message]
2026-08-09 10:02   ` Mete Durlu

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=20260807034211.1148245-1-zhanxusheng@xiaomi.com \
    --to=zhanxusheng1024@gmail.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=meted@linux.ibm.com \
    --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=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®