<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/sched/idle.c, branch linux-6.12.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.12.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.12.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2026-01-30T09:28:42Z</updated>
<entry>
<title>sched/fair: Fix pelt clock sync when entering idle</title>
<updated>2026-01-30T09:28:42Z</updated>
<author>
<name>Vincent Guittot</name>
</author>
<published>2026-01-21T16:33:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eb24c281ee879fe6aff1f9cf26ee617ba501c6de'/>
<id>urn:sha1:eb24c281ee879fe6aff1f9cf26ee617ba501c6de</id>
<content type='text'>
[ Upstream commit 98c88dc8a1ace642d9021b103b28cba7b51e3abc ]

Samuel and Alex reported regressions of the util_avg of RT rq with
commit 17e3e88ed0b6 ("sched/fair: Fix pelt lost idle time detection").
It happens that fair is updating and syncing the pelt clock with task one
when pick_next_task_fair() fails to pick a task but before the prev
scheduling class got a chance to update its pelt signals.

Move update_idle_rq_clock_pelt() in set_next_task_idle() which is called
after prev class has been called.

Fixes: 17e3e88ed0b6 ("sched/fair: Fix pelt lost idle time detection")
Closes: https://lore.kernel.org/all/CAG2KctpO6VKS6GN4QWDji0t92_gNBJ7HjjXrE+6H+RwRXt=iLg@mail.gmail.com/
Closes: https://lore.kernel.org/all/8cf19bf0e0054dcfed70e9935029201694f1bb5a.camel@mediatek.com/
Reported-by: Samuel Wu &lt;wusamuel@google.com&gt;
Reported-by: Alex Hoh &lt;Alex.Hoh@mediatek.com&gt;
Signed-off-by: Vincent Guittot &lt;vincent.guittot@linaro.org&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Tested-by: Samuel Wu &lt;wusamuel@google.com&gt;
Tested-by: Alex Hoh &lt;Alex.Hoh@mediatek.com&gt;
Link: https://patch.msgid.link/20260121163317.505635-1-vincent.guittot@linaro.org
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>sched_ext: idle: Refresh idle masks during idle-to-idle transitions</title>
<updated>2025-01-17T12:40:49Z</updated>
<author>
<name>Andrea Righi</name>
</author>
<published>2025-01-10T22:16:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cfe32daafd6ca0b23e3d2d299e249e78506d6779'/>
<id>urn:sha1:cfe32daafd6ca0b23e3d2d299e249e78506d6779</id>
<content type='text'>
[ Upstream commit a2a3374c47c428c0edb0bbc693638d4783f81e31 ]

With the consolidation of put_prev_task/set_next_task(), see
commit 436f3eed5c69 ("sched: Combine the last put_prev_task() and the
first set_next_task()"), we are now skipping the transition between
these two functions when the previous and the next tasks are the same.

As a result, the scx idle state of a CPU is updated only when
transitioning to or from the idle thread. While this is generally
correct, it can lead to uneven and inefficient core utilization in
certain scenarios [1].

A typical scenario involves proactive wake-ups: scx_bpf_pick_idle_cpu()
selects and marks an idle CPU as busy, followed by a wake-up via
scx_bpf_kick_cpu(), without dispatching any tasks. In this case, the CPU
continues running the idle thread, returns to idle, but remains marked
as busy, preventing it from being selected again as an idle CPU (until a
task eventually runs on it and releases the CPU).

For example, running a workload that uses 20% of each CPU, combined with
an scx scheduler using proactive wake-ups, results in the following core
utilization:

 CPU 0: 25.7%
 CPU 1: 29.3%
 CPU 2: 26.5%
 CPU 3: 25.5%
 CPU 4:  0.0%
 CPU 5: 25.5%
 CPU 6:  0.0%
 CPU 7: 10.5%

To address this, refresh the idle state also in pick_task_idle(), during
idle-to-idle transitions, but only trigger ops.update_idle() on actual
state changes to prevent unnecessary updates to the scx scheduler and
maintain balanced state transitions.

With this change in place, the core utilization in the previous example
becomes the following:

 CPU 0: 18.8%
 CPU 1: 19.4%
 CPU 2: 18.0%
 CPU 3: 18.7%
 CPU 4: 19.3%
 CPU 5: 18.9%
 CPU 6: 18.7%
 CPU 7: 19.3%

[1] https://github.com/sched-ext/scx/pull/1139

Fixes: 7c65ae81ea86 ("sched_ext: Don't call put_prev_task_scx() before picking the next task")
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>Merge branch 'tip/sched/core' into for-6.12</title>
<updated>2024-09-03T22:49:18Z</updated>
<author>
<name>Tejun Heo</name>
</author>
<published>2024-09-03T19:15:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d7b01aef9dbd50f190c2c340deaf324806d09885'/>
<id>urn:sha1:d7b01aef9dbd50f190c2c340deaf324806d09885</id>
<content type='text'>
- Resolve trivial context conflicts from dl_server clearing being moved
  around.

- Add @next to put_prev_task_scx() and @prev to pick_next_task_scx() to
  match sched/core.

- Merge sched_class-&gt;switch_class() addition from sched_ext with
  tip/sched/core changes in __pick_next_task().

- Make pick_next_task_scx() call put_prev_task_scx() to emulate the previous
  behavior where sched_class-&gt;put_prev_task() was called before
  sched_class-&gt;pick_next_task().

While this makes sched_ext build and function, the behavior is not in line
with other sched classes. The follow-up patches will address the
discrepancies and remove sched_class-&gt;switch_class().

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>sched: Add put_prev_task(.next)</title>
<updated>2024-09-03T13:26:32Z</updated>
<author>
<name>Peter Zijlstra</name>
</author>
<published>2024-08-13T22:25:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b2d70222dbf2a2ff7a972a685d249a5d75afa87f'/>
<id>urn:sha1:b2d70222dbf2a2ff7a972a685d249a5d75afa87f</id>
<content type='text'>
In order to tell the previous sched_class what the next task is, add
put_prev_task(.next).

Notable SCX will use this to:

 1) determine the next task will leave the SCX sched class and push
    the current task to another CPU if possible.
 2) statistics on how often and which other classes preempt it

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20240813224016.367421076@infradead.org
</content>
</entry>
<entry>
<title>sched: Rework pick_next_task()</title>
<updated>2024-09-03T13:26:31Z</updated>
<author>
<name>Peter Zijlstra</name>
</author>
<published>2024-08-13T22:25:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fd03c5b8585562d60f8b597b4332d28f48abfe7d'/>
<id>urn:sha1:fd03c5b8585562d60f8b597b4332d28f48abfe7d</id>
<content type='text'>
The current rule is that:

  pick_next_task() := pick_task() + set_next_task(.first = true)

And many classes implement it directly as such. Change things around
to make pick_next_task() optional while also changing the definition to:

  pick_next_task(prev) := pick_task() + put_prev_task() + set_next_task(.first = true)

The reason is that sched_ext would like to have a 'final' call that
knows the next task. By placing put_prev_task() right next to
set_next_task() (as it already is for sched_core) this becomes
trivial.

As a bonus, this is a nice cleanup on its own.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20240813224016.051225657@infradead.org
</content>
</entry>
<entry>
<title>Merge branch 'tip/sched/core' into for-6.12</title>
<updated>2024-08-20T18:55:26Z</updated>
<author>
<name>Tejun Heo</name>
</author>
<published>2024-08-20T18:55:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5ac998574f93ac042cb84b4f1d919e2b20966afe'/>
<id>urn:sha1:5ac998574f93ac042cb84b4f1d919e2b20966afe</id>
<content type='text'>
To receive 863ccdbb918a ("sched: Allow sched_class::dequeue_task() to fail")
which makes sched_class.dequeue_task() return bool instead of void. This
leads to compile breakage and will be fixed by a follow-up patch.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>sched: Allow sched_class::dequeue_task() to fail</title>
<updated>2024-08-17T09:06:41Z</updated>
<author>
<name>Peter Zijlstra</name>
</author>
<published>2024-04-03T07:50:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=863ccdbb918a77e3f011571f943020bf7f0b114b'/>
<id>urn:sha1:863ccdbb918a77e3f011571f943020bf7f0b114b</id>
<content type='text'>
Change the function signature of sched_class::dequeue_task() to return
a boolean, allowing future patches to 'fail' dequeue.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Valentin Schneider &lt;vschneid@redhat.com&gt;
Tested-by: Valentin Schneider &lt;vschneid@redhat.com&gt;
Link: https://lkml.kernel.org/r/20240727105028.864630153@infradead.org
</content>
</entry>
<entry>
<title>Merge branch 'sched/core' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into for-6.12</title>
<updated>2024-08-04T17:36:54Z</updated>
<author>
<name>Tejun Heo</name>
</author>
<published>2024-08-04T17:07:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0df340ceae2e51ccc6a8a19f4182f389223fbfdf'/>
<id>urn:sha1:0df340ceae2e51ccc6a8a19f4182f389223fbfdf</id>
<content type='text'>
Pull tip/sched/core to resolve the following four conflicts. While 2-4 are
simple context conflicts, 1 is a bit subtle and easy to resolve incorrectly.

1. 2c8d046d5d51 ("sched: Add normal_policy()")
   vs.
   faa42d29419d ("sched/fair: Make SCHED_IDLE entity be preempted in strict hierarchy")

The former converts direct test on p-&gt;policy to use the helper
normal_policy(). The latter moves the p-&gt;policy test to a different
location. Resolve by converting the test on p-&gt;plicy in the new location to
use normal_policy().

2. a7a9fc549293 ("sched_ext: Add boilerplate for extensible scheduler class")
   vs.
   a110a81c52a9 ("sched/deadline: Deferrable dl server")

Both add calls to put_prev_task_idle() and set_next_task_idle(). Simple
context conflict. Resolve by taking changes from both.

3. a7a9fc549293 ("sched_ext: Add boilerplate for extensible scheduler class")
   vs.
   c245910049d0 ("sched/core: Add clearing of -&gt;dl_server in put_prev_task_balance()")

The former changes for_each_class() itertion to use for_each_active_class().
The latter moves away the adjacent dl_server handling code. Simple context
conflict. Resolve by taking changes from both.

4. 60c27fb59f6c ("sched_ext: Implement sched_ext_ops.cpu_online/offline()")
   vs.
   31b164e2e4af ("sched/smt: Introduce sched_smt_present_inc/dec() helper")
   2f027354122f ("sched/core: Introduce sched_set_rq_on/offline() helper")

The former adds scx_rq_deactivate() call. The latter two change code around
it. Simple context conflict. Resolve by taking changes from both.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>sched/deadline: Deferrable dl server</title>
<updated>2024-07-29T10:22:36Z</updated>
<author>
<name>Daniel Bristot de Oliveira</name>
</author>
<published>2024-05-27T12:06:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a110a81c52a9de73e2e57e826dd3bf0fd4c22226'/>
<id>urn:sha1:a110a81c52a9de73e2e57e826dd3bf0fd4c22226</id>
<content type='text'>
Among the motivations for the DL servers is the real-time throttling
mechanism. This mechanism works by throttling the rt_rq after
running for a long period without leaving space for fair tasks.

The base dl server avoids this problem by boosting fair tasks instead
of throttling the rt_rq. The point is that it boosts without waiting
for potential starvation, causing some non-intuitive cases.

For example, an IRQ dispatches two tasks on an idle system, a fair
and an RT. The DL server will be activated, running the fair task
before the RT one. This problem can be avoided by deferring the
dl server activation.

By setting the defer option, the dl_server will dispatch an
SCHED_DEADLINE reservation with replenished runtime, but throttled.

The dl_timer will be set for the defer time at (period - runtime) ns
from start time. Thus boosting the fair rq at defer time.

If the fair scheduler has the opportunity to run while waiting
for defer time, the dl server runtime will be consumed. If
the runtime is completely consumed before the defer time, the
server will be replenished while still in a throttled state. Then,
the dl_timer will be reset to the new defer time

If the fair server reaches the defer time without consuming
its runtime, the server will start running, following CBS rules
(thus without breaking SCHED_DEADLINE). Then the server will
continue the running state (without deferring) until it fair
tasks are able to execute as regular fair scheduler (end of
the starvation).

Signed-off-by: Daniel Bristot de Oliveira &lt;bristot@kernel.org&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Tested-by: Juri Lelli &lt;juri.lelli@redhat.com&gt;
Link: https://lore.kernel.org/r/dd175943c72533cd9f0b87767c6499204879cc38.1716811044.git.bristot@kernel.org
</content>
</entry>
<entry>
<title>sched_ext: Add boilerplate for extensible scheduler class</title>
<updated>2024-06-18T20:09:17Z</updated>
<author>
<name>Tejun Heo</name>
</author>
<published>2024-06-18T20:09:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a7a9fc549293168c1edbc8433d5d4fbbe1171630'/>
<id>urn:sha1:a7a9fc549293168c1edbc8433d5d4fbbe1171630</id>
<content type='text'>
This adds dummy implementations of sched_ext interfaces which interact with
the scheduler core and hook them in the correct places. As they're all
dummies, this doesn't cause any behavior changes. This is split out to help
reviewing.

v2: balance_scx_on_up() dropped. This will be handled in sched_ext proper.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reviewed-by: David Vernet &lt;dvernet@meta.com&gt;
Acked-by: Josh Don &lt;joshdon@google.com&gt;
Acked-by: Hao Luo &lt;haoluo@google.com&gt;
Acked-by: Barret Rhoden &lt;brho@google.com&gt;
</content>
</entry>
</feed>
