<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/sched/ext_idle.c, branch linux-6.15.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.15.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.15.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2025-06-19T13:40:29Z</updated>
<entry>
<title>sched_ext: idle: Skip cross-node search with !CONFIG_NUMA</title>
<updated>2025-06-19T13:40:29Z</updated>
<author>
<name>Andrea Righi</name>
</author>
<published>2025-06-03T08:22:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9219079c52821246b2395bd30a4a2ffb9681e9e6'/>
<id>urn:sha1:9219079c52821246b2395bd30a4a2ffb9681e9e6</id>
<content type='text'>
[ Upstream commit 9960be72a54cf0e4d47abdd4cacd1278835a3bb4 ]

In the idle CPU selection logic, attempting cross-node searches adds
unnecessary complexity when CONFIG_NUMA is disabled.

Since there's no meaningful concept of nodes in this case, simplify the
logic by restricting the idle CPU search to the current node only.

Fixes: 48849271e6611 ("sched_ext: idle: Per-node idle cpumasks")
Signed-off-by: Andrea Righi &lt;arighi@nvidia.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>sched_ext: Track currently locked rq</title>
<updated>2025-04-22T19:27:50Z</updated>
<author>
<name>Andrea Righi</name>
</author>
<published>2025-04-22T08:26:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=18853ba782bef65fc81ef2b3370382e5b479c5eb'/>
<id>urn:sha1:18853ba782bef65fc81ef2b3370382e5b479c5eb</id>
<content type='text'>
Some kfuncs provided by sched_ext may need to operate on a struct rq,
but they can be invoked from various contexts, specifically, different
scx callbacks.

While some of these callbacks are invoked with a particular rq already
locked, others are not. This makes it impossible for a kfunc to reliably
determine whether it's safe to access a given rq, triggering potential
bugs or unsafe behaviors, see for example [1].

To address this, track the currently locked rq whenever a sched_ext
callback is invoked via SCX_CALL_OP*().

This allows kfuncs that need to operate on an arbitrary rq to retrieve
the currently locked one and apply the appropriate action as needed.

[1] https://lore.kernel.org/lkml/20250325140021.73570-1-arighi@nvidia.com/

Suggested-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Andrea Righi &lt;arighi@nvidia.com&gt;
Acked-by: Changwoo Min &lt;changwoo@igalia.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>sched_ext: initialize built-in idle state before ops.init()</title>
<updated>2025-03-26T20:47:50Z</updated>
<author>
<name>Andrea Righi</name>
</author>
<published>2025-03-25T09:32:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f0c6eab5e45c529f449fbc595873719e00de6d79'/>
<id>urn:sha1:f0c6eab5e45c529f449fbc595873719e00de6d79</id>
<content type='text'>
A BPF scheduler may want to use the built-in idle cpumasks in ops.init()
before the scheduler is fully initialized, either directly or through a
BPF timer for example.

However, this would result in an error, since the idle state has not
been properly initialized yet.

This can be easily verified by modifying scx_simple to call
scx_bpf_get_idle_cpumask() in ops.init():

$ sudo scx_simple

DEBUG DUMP
===========================================================================

scx_simple[121] triggered exit kind 1024:
  runtime error (built-in idle tracking is disabled)
...

Fix this by properly initializing the idle state before ops.init() is
called. With this change applied:

$ sudo scx_simple
local=2 global=0
local=19 global=11
local=23 global=11
...

Fixes: d73249f88743d ("sched_ext: idle: Make idle static keys private")
Signed-off-by: Andrea Righi &lt;arighi@nvidia.com&gt;
Reviewed-by: Joel Fernandes &lt;joelagnelf@nvidia.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>sched_ext: Remove a meaningless conditional goto in scx_select_cpu_dfl()</title>
<updated>2025-03-26T20:09:47Z</updated>
<author>
<name>Tejun Heo</name>
</author>
<published>2025-03-26T20:09:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=883cc35e9fef6ee5cedf535d26d7143172d60225'/>
<id>urn:sha1:883cc35e9fef6ee5cedf535d26d7143172d60225</id>
<content type='text'>
scx_select_cpu_dfl() has a meaningless conditional goto at the end. Remove
it. No functional changes.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Andrea Righi &lt;arighi@nvidia.com&gt;
</content>
</entry>
<entry>
<title>sched_ext: idle: Fix return code of scx_select_cpu_dfl()</title>
<updated>2025-03-26T20:08:01Z</updated>
<author>
<name>Andrea Righi</name>
</author>
<published>2025-03-26T19:18:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=37477d9ecabd15323700313724479bea94d0421e'/>
<id>urn:sha1:37477d9ecabd15323700313724479bea94d0421e</id>
<content type='text'>
Return -EBUSY when using %SCX_PICK_IDLE_CORE with scx_select_cpu_dfl()
if a fully idle SMT core cannot be found, instead of falling back to
@prev_cpu, which is not a fully idle SMT core in this case.

Fixes: c414c2171cd9e ("sched_ext: idle: Honor idle flags in the built-in idle selection policy")
Signed-off-by: Andrea Righi &lt;arighi@nvidia.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>sched_ext: idle: Refactor scx_select_cpu_dfl()</title>
<updated>2025-03-14T18:17:11Z</updated>
<author>
<name>Andrea Righi</name>
</author>
<published>2025-03-14T09:45:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e4855fc90e52efef7e3926205c8dc53ce39b6138'/>
<id>urn:sha1:e4855fc90e52efef7e3926205c8dc53ce39b6138</id>
<content type='text'>
Make scx_select_cpu_dfl() more consistent with the other idle-related
APIs by returning a negative value when an idle CPU isn't found.

No functional changes, this is purely a refactoring.

Signed-off-by: Andrea Righi &lt;arighi@nvidia.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>sched_ext: idle: Honor idle flags in the built-in idle selection policy</title>
<updated>2025-03-14T18:17:01Z</updated>
<author>
<name>Andrea Righi</name>
</author>
<published>2025-03-14T09:45:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c414c2171cd9ec2475fd641a16d6b2cac3344390'/>
<id>urn:sha1:c414c2171cd9ec2475fd641a16d6b2cac3344390</id>
<content type='text'>
Enable passing idle flags (%SCX_PICK_IDLE_*) to scx_select_cpu_dfl(),
to enforce strict selection criteria, such as selecting an idle CPU
strictly within @prev_cpu's node or choosing only a fully idle SMT core.

This functionality will be exposed through a dedicated kfunc in a
separate patch.

Signed-off-by: Andrea Righi &lt;arighi@nvidia.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>sched_ext: Merge branch 'for-6.14-fixes' into for-6.15</title>
<updated>2025-03-03T18:02:22Z</updated>
<author>
<name>Tejun Heo</name>
</author>
<published>2025-03-03T18:02:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8a9b1585e2bf2a4d335774c893f5e80cf9262b6d'/>
<id>urn:sha1:8a9b1585e2bf2a4d335774c893f5e80cf9262b6d</id>
<content type='text'>
Pull for-6.14-fixes to receive:

  9360dfe4cbd6 ("sched_ext: Validate prev_cpu in scx_bpf_select_cpu_dfl()")

which conflicts with:

  337d1b354a29 ("sched_ext: Move built-in idle CPU selection policy to a separate file")

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>sched_ext: idle: Fix scx_bpf_pick_any_cpu_node() behavior</title>
<updated>2025-02-25T18:35:53Z</updated>
<author>
<name>Andrea Righi</name>
</author>
<published>2025-02-25T09:37:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fde7d64766c1142fe79507bbef4968cee274cc0b'/>
<id>urn:sha1:fde7d64766c1142fe79507bbef4968cee274cc0b</id>
<content type='text'>
When %SCX_PICK_IDLE_IN_NODE is specified, scx_bpf_pick_any_cpu_node()
should always return a CPU from the specified node, regardless of its
idle state.

Also clarify this logic in the function documentation.

Fixes: 01059219b0cfd ("sched_ext: idle: Introduce node-aware idle cpu kfunc helpers")
Signed-off-by: Andrea Righi &lt;arighi@nvidia.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>sched_ext: idle: Introduce node-aware idle cpu kfunc helpers</title>
<updated>2025-02-18T19:10:24Z</updated>
<author>
<name>Andrea Righi</name>
</author>
<published>2025-02-18T18:04:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=01059219b0cfdb9fc0d5bd60458e614a3135e6e7'/>
<id>urn:sha1:01059219b0cfdb9fc0d5bd60458e614a3135e6e7</id>
<content type='text'>
Introduce a new kfunc to retrieve the node associated to a CPU:

 int scx_bpf_cpu_node(s32 cpu)

Add the following kfuncs to provide BPF schedulers direct access to
per-node idle cpumasks information:

 const struct cpumask *scx_bpf_get_idle_cpumask_node(int node)
 const struct cpumask *scx_bpf_get_idle_smtmask_node(int node)
 s32 scx_bpf_pick_idle_cpu_node(const cpumask_t *cpus_allowed,
 				int node, u64 flags)
 s32 scx_bpf_pick_any_cpu_node(const cpumask_t *cpus_allowed,
 			       int node, u64 flags)

Moreover, trigger an scx error when any of the non-node aware idle CPU
kfuncs are used when SCX_OPS_BUILTIN_IDLE_PER_NODE is enabled.

Cc: Yury Norov [NVIDIA] &lt;yury.norov@gmail.com&gt;
Signed-off-by: Andrea Righi &lt;arighi@nvidia.com&gt;
Reviewed-by: Yury Norov [NVIDIA] &lt;yury.norov@gmail.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
</feed>
