Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Cheng-Yang Chou <yphbchou0911@gmail.com>
To: sched-ext@lists.linux.dev, Tejun Heo <tj@kernel.org>,
	David Vernet <void@manifault.com>,
	Andrea Righi <arighi@nvidia.com>,
	Changwoo Min <changwoo@igalia.com>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Mike Rapoport <rppt@kernel.org>
Cc: Ching-Chun Huang <jserv@ccns.ncku.edu.tw>,
	Chia-Ping Tsai <chia7712@gmail.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>, "H . Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Arnd Bergmann <arnd@arndb.de>,
	linux-arch@vger.kernel.org, chengyang.chou@mediatek.com,
	Cheng-Yang Chou <yphbchou0911@gmail.com>
Subject: [PATCH v2 mm and sched_ext/for-7.5 0/2] Skip nodes without CPUs in the sched_ext idle walk
Date: Tue,  1 Dec 2026 17:18:01 +0800	[thread overview]
Message-ID: <20261201091829.16311-1-yphbchou0911@gmail.com> (raw)

With numa=fake, NUMA emulation sets a CPU in cpumask_of_node() of every
emulated node on its physical node, while cpu_to_node() returns only
one of them. On a Raspberry Pi 5, whose firmware adds numa=fake=8, all
eight nodes list CPUs 0-3 and have N_CPU set, but cpu_to_node() is 0
for every CPU. sched_ext's per-node idle walk then visits seven nodes
that can't have an idle CPU.

As Tejun suggested [1], patch 1 makes NUMA emulation set a CPU only in
the cpumask of its own node, and patch 2 makes sched_ext walk
node_states[N_CPU] instead of N_ONLINE.

On the rpi5 under hackbench, the per-node ops.select_cpu() time goes
from 484ns to 141ns, against 139ns with the global idle cpumask.

This series is based on sched_ext/for-7.5. Patch 1 also applies cleanly
to memblock/for-next.

[1] https://lore.kernel.org/all/e89bc79ed200cc40699ad62bb3d762b7@kernel.org/

Changes in v2:
- Fix NUMA emulation and walk N_CPU instead of keeping a separate node
  mask in sched_ext. (Tejun)
- Link to v1:
  https://lore.kernel.org/all/20261129163536.15478-1-yphbchou0911@gmail.com/

Cheng-Yang Chou (2):
  mm/fake-numa: map each CPU only to its own node
  sched_ext/idle: Skip nodes without CPUs

 arch/x86/mm/numa.c         |  4 ---
 include/asm-generic/numa.h |  4 ---
 kernel/sched/ext/idle.c    |  4 +--
 mm/arch_numa.c             | 26 ---------------
 mm/numa_emulation.c        | 67 ++------------------------------------
 5 files changed, 5 insertions(+), 100 deletions(-)


base-commit: 95a4df9944cd5d57a92662269114ba99cb972394
-- 
2.56.0



             reply	other threads:[~2026-12-01  9:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  9:18 Cheng-Yang Chou [this message]
2026-12-01  9:18 ` [PATCH v2 mm and sched_ext/for-7.5 1/2] mm/fake-numa: map each CPU only to its own node Cheng-Yang Chou
2026-12-01  9:18 ` [PATCH v2 mm and sched_ext/for-7.5 2/2] sched_ext/idle: Skip nodes without CPUs Cheng-Yang Chou
2026-12-01 15:45   ` Tejun Heo

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=20261201091829.16311-1-yphbchou0911@gmail.com \
    --to=yphbchou0911@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arighi@nvidia.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=changwoo@igalia.com \
    --cc=chengyang.chou@mediatek.com \
    --cc=chia7712@gmail.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jserv@ccns.ncku.edu.tw \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rppt@kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=tglx@kernel.org \
    --cc=tj@kernel.org \
    --cc=void@manifault.com \
    --cc=x86@kernel.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