<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/sched/sched.h, branch linux-6.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-08-03T07:00:32Z</updated>
<entry>
<title>sched/fair: set_load_weight() must also call reweight_task() for SCHED_IDLE tasks</title>
<updated>2024-08-03T07:00:32Z</updated>
<author>
<name>Tejun Heo</name>
</author>
<published>2024-06-26T01:29:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=054dc05f57694d9e1d22cccee268adb3a6ebc6ff'/>
<id>urn:sha1:054dc05f57694d9e1d22cccee268adb3a6ebc6ff</id>
<content type='text'>
commit d329605287020c3d1c3b0dadc63d8208e7251382 upstream.

When a task's weight is being changed, set_load_weight() is called with
@update_load set. As weight changes aren't trivial for the fair class,
set_load_weight() calls fair.c::reweight_task() for fair class tasks.

However, set_load_weight() first tests task_has_idle_policy() on entry and
skips calling reweight_task() for SCHED_IDLE tasks. This is buggy as
SCHED_IDLE tasks are just fair tasks with a very low weight and they would
incorrectly skip load, vlag and position updates.

Fix it by updating reweight_task() to take struct load_weight as idle weight
can't be expressed with prio and making set_load_weight() call
reweight_task() for SCHED_IDLE tasks too when @update_load is set.

Fixes: 9059393e4ec1 ("sched/fair: Use reweight_entity() for set_user_nice()")
Suggested-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Cc: stable@vger.kernel.org # v4.15+
Link: http://lkml.kernel.org/r/20240624102331.GI31592@noisy.programming.kicks-ass.net
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>sched: Move psi_account_irqtime() out of update_rq_clock_task() hotpath</title>
<updated>2024-07-01T11:01:44Z</updated>
<author>
<name>John Stultz</name>
</author>
<published>2024-06-18T21:58:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ddae0ca2a8fe12d0e24ab10ba759c3fbd755ada8'/>
<id>urn:sha1:ddae0ca2a8fe12d0e24ab10ba759c3fbd755ada8</id>
<content type='text'>
It was reported that in moving to 6.1, a larger then 10%
regression was seen in the performance of
clock_gettime(CLOCK_THREAD_CPUTIME_ID,...).

Using a simple reproducer, I found:
5.10:
100000000 calls in 24345994193 ns =&gt; 243.460 ns per call
100000000 calls in 24288172050 ns =&gt; 242.882 ns per call
100000000 calls in 24289135225 ns =&gt; 242.891 ns per call

6.1:
100000000 calls in 28248646742 ns =&gt; 282.486 ns per call
100000000 calls in 28227055067 ns =&gt; 282.271 ns per call
100000000 calls in 28177471287 ns =&gt; 281.775 ns per call

The cause of this was finally narrowed down to the addition of
psi_account_irqtime() in update_rq_clock_task(), in commit
52b1364ba0b1 ("sched/psi: Add PSI_IRQ to track IRQ/SOFTIRQ
pressure").

In my initial attempt to resolve this, I leaned towards moving
all accounting work out of the clock_gettime() call path, but it
wasn't very pretty, so it will have to wait for a later deeper
rework. Instead, Peter shared this approach:

Rework psi_account_irqtime() to use its own psi_irq_time base
for accounting, and move it out of the hotpath, calling it
instead from sched_tick() and __schedule().

In testing this, we found the importance of ensuring
psi_account_irqtime() is run under the rq_lock, which Johannes
Weiner helpfully explained, so also add some lockdep annotations
to make that requirement clear.

With this change the performance is back in-line with 5.10:
6.1+fix:
100000000 calls in 24297324597 ns =&gt; 242.973 ns per call
100000000 calls in 24318869234 ns =&gt; 243.189 ns per call
100000000 calls in 24291564588 ns =&gt; 242.916 ns per call

Reported-by: Jimmy Shiu &lt;jimmyshiu@google.com&gt;
Originally-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: John Stultz &lt;jstultz@google.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Chengming Zhou &lt;chengming.zhou@linux.dev&gt;
Reviewed-by: Qais Yousef &lt;qyousef@layalina.io&gt;
Link: https://lore.kernel.org/r/20240618215909.4099720-1-jstultz@google.com
</content>
</entry>
<entry>
<title>Merge tag 'sched-core-2024-05-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2024-05-14T00:18:51Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2024-05-14T00:18:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6e5a0c30b616bfff6926ecca5d88e3d06e6bf79a'/>
<id>urn:sha1:6e5a0c30b616bfff6926ecca5d88e3d06e6bf79a</id>
<content type='text'>
Pull scheduler updates from Ingo Molnar:

 - Add cpufreq pressure feedback for the scheduler

 - Rework misfit load-balancing wrt affinity restrictions

 - Clean up and simplify the code around ::overutilized and
   ::overload access.

 - Simplify sched_balance_newidle()

 - Bump SCHEDSTAT_VERSION to 16 due to a cleanup of CPU_MAX_IDLE_TYPES
   handling that changed the output.

 - Rework &amp; clean up &lt;asm/vtime.h&gt; interactions wrt arch_vtime_task_switch()

 - Reorganize, clean up and unify most of the higher level
   scheduler balancing function names around the sched_balance_*()
   prefix

 - Simplify the balancing flag code (sched_balance_running)

 - Miscellaneous cleanups &amp; fixes

* tag 'sched-core-2024-05-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (50 commits)
  sched/pelt: Remove shift of thermal clock
  sched/cpufreq: Rename arch_update_thermal_pressure() =&gt; arch_update_hw_pressure()
  thermal/cpufreq: Remove arch_update_thermal_pressure()
  sched/cpufreq: Take cpufreq feedback into account
  cpufreq: Add a cpufreq pressure feedback for the scheduler
  sched/fair: Fix update of rd-&gt;sg_overutilized
  sched/vtime: Do not include &lt;asm/vtime.h&gt; header
  s390/irq,nmi: Include &lt;asm/vtime.h&gt; header directly
  s390/vtime: Remove unused __ARCH_HAS_VTIME_TASK_SWITCH leftover
  sched/vtime: Get rid of generic vtime_task_switch() implementation
  sched/vtime: Remove confusing arch_vtime_task_switch() declaration
  sched/balancing: Simplify the sg_status bitmask and use separate -&gt;overloaded and -&gt;overutilized flags
  sched/fair: Rename set_rd_overutilized_status() to set_rd_overutilized()
  sched/fair: Rename SG_OVERLOAD to SG_OVERLOADED
  sched/fair: Rename {set|get}_rd_overload() to {set|get}_rd_overloaded()
  sched/fair: Rename root_domain::overload to ::overloaded
  sched/fair: Use helper functions to access root_domain::overload
  sched/fair: Check root_domain::overload value before update
  sched/fair: Combine EAS check with root_domain::overutilized access
  sched/fair: Simplify the continue_balancing logic in sched_balance_newidle()
  ...
</content>
</entry>
<entry>
<title>sched/pelt: Remove shift of thermal clock</title>
<updated>2024-04-24T10:08:02Z</updated>
<author>
<name>Vincent Guittot</name>
</author>
<published>2024-03-26T09:16:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=97450eb909658573dcacc1063b06d3d08642c0c1'/>
<id>urn:sha1:97450eb909658573dcacc1063b06d3d08642c0c1</id>
<content type='text'>
The optional shift of the clock used by thermal/hw load avg has been
introduced to handle case where the signal was not always a high frequency
hw signal. Now that cpufreq provides a signal for firmware and
SW pressure, we can remove this exception and always keep this PELT signal
aligned with other signals.
Mark sysctl_sched_migration_cost boot parameter as deprecated

Signed-off-by: Vincent Guittot &lt;vincent.guittot@linaro.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Tested-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Reviewed-by: Qais Yousef &lt;qyousef@layalina.io&gt;
Reviewed-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Link: https://lore.kernel.org/r/20240326091616.3696851-6-vincent.guittot@linaro.org
</content>
</entry>
<entry>
<title>sched/cpufreq: Rename arch_update_thermal_pressure() =&gt; arch_update_hw_pressure()</title>
<updated>2024-04-24T10:08:01Z</updated>
<author>
<name>Vincent Guittot</name>
</author>
<published>2024-03-26T09:16:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d4dbc991714eefcbd8d54a3204bd77a0a52bd32d'/>
<id>urn:sha1:d4dbc991714eefcbd8d54a3204bd77a0a52bd32d</id>
<content type='text'>
Now that cpufreq provides a pressure value to the scheduler, rename
arch_update_thermal_pressure into HW pressure to reflect that it returns
a pressure applied by HW (i.e. with a high frequency change) and not
always related to thermal mitigation but also generated by max current
limitation as an example. Such high frequency signal needs filtering to be
smoothed and provide an value that reflects the average available capacity
into the scheduler time scale.

Signed-off-by: Vincent Guittot &lt;vincent.guittot@linaro.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Tested-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Reviewed-by: Qais Yousef &lt;qyousef@layalina.io&gt;
Reviewed-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Link: https://lore.kernel.org/r/20240326091616.3696851-5-vincent.guittot@linaro.org
</content>
</entry>
<entry>
<title>sched: Add missing memory barrier in switch_mm_cid</title>
<updated>2024-04-16T11:59:45Z</updated>
<author>
<name>Mathieu Desnoyers</name>
</author>
<published>2024-04-15T15:21:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fe90f3967bdb3e13f133e5f44025e15f943a99c5'/>
<id>urn:sha1:fe90f3967bdb3e13f133e5f44025e15f943a99c5</id>
<content type='text'>
Many architectures' switch_mm() (e.g. arm64) do not have an smp_mb()
which the core scheduler code has depended upon since commit:

    commit 223baf9d17f25 ("sched: Fix performance regression introduced by mm_cid")

If switch_mm() doesn't call smp_mb(), sched_mm_cid_remote_clear() can
unset the actively used cid when it fails to observe active task after it
sets lazy_put.

There *is* a memory barrier between storing to rq-&gt;curr and _return to
userspace_ (as required by membarrier), but the rseq mm_cid has stricter
requirements: the barrier needs to be issued between store to rq-&gt;curr
and switch_mm_cid(), which happens earlier than:

  - spin_unlock(),
  - switch_to().

So it's fine when the architecture switch_mm() happens to have that
barrier already, but less so when the architecture only provides the
full barrier in switch_to() or spin_unlock().

It is a bug in the rseq switch_mm_cid() implementation. All architectures
that don't have memory barriers in switch_mm(), but rather have the full
barrier either in finish_lock_switch() or switch_to() have them too late
for the needs of switch_mm_cid().

Introduce a new smp_mb__after_switch_mm(), defined as smp_mb() in the
generic barrier.h header, and use it in switch_mm_cid() for scheduler
transitions where switch_mm() is expected to provide a memory barrier.

Architectures can override smp_mb__after_switch_mm() if their
switch_mm() implementation provides an implicit memory barrier.
Override it with a no-op on x86 which implicitly provide this memory
barrier by writing to CR3.

Fixes: 223baf9d17f2 ("sched: Fix performance regression introduced by mm_cid")
Reported-by: levi.yun &lt;yeoreum.yun@arm.com&gt;
Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Reviewed-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt; # for arm64
Acked-by: Dave Hansen &lt;dave.hansen@linux.intel.com&gt; # for x86
Cc: &lt;stable@vger.kernel.org&gt; # 6.4.x
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Link: https://lore.kernel.org/r/20240415152114.59122-2-mathieu.desnoyers@efficios.com
</content>
</entry>
<entry>
<title>sched/balancing: Simplify the sg_status bitmask and use separate -&gt;overloaded and -&gt;overutilized flags</title>
<updated>2024-03-29T06:53:27Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2024-03-28T11:07:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4475cd8bfd9bcb898953fcadb2f51b3432eb68a1'/>
<id>urn:sha1:4475cd8bfd9bcb898953fcadb2f51b3432eb68a1</id>
<content type='text'>
SG_OVERLOADED and SG_OVERUTILIZED flags plus the sg_status bitmask are an
unnecessary complication that only make the code harder to read and slower.

We only ever set them separately:

 thule:~/tip&gt; git grep SG_OVER kernel/sched/
 kernel/sched/fair.c:            set_rd_overutilized_status(rq-&gt;rd, SG_OVERUTILIZED);
 kernel/sched/fair.c:                    *sg_status |= SG_OVERLOADED;
 kernel/sched/fair.c:                    *sg_status |= SG_OVERUTILIZED;
 kernel/sched/fair.c:                            *sg_status |= SG_OVERLOADED;
 kernel/sched/fair.c:            set_rd_overloaded(env-&gt;dst_rq-&gt;rd, sg_status &amp; SG_OVERLOADED);
 kernel/sched/fair.c:                                       sg_status &amp; SG_OVERUTILIZED);
 kernel/sched/fair.c:    } else if (sg_status &amp; SG_OVERUTILIZED) {
 kernel/sched/fair.c:            set_rd_overutilized_status(env-&gt;dst_rq-&gt;rd, SG_OVERUTILIZED);
 kernel/sched/sched.h:#define SG_OVERLOADED              0x1 /* More than one runnable task on a CPU. */
 kernel/sched/sched.h:#define SG_OVERUTILIZED            0x2 /* One or more CPUs are over-utilized. */
 kernel/sched/sched.h:           set_rd_overloaded(rq-&gt;rd, SG_OVERLOADED);

And use them separately, which results in suboptimal code:

                /* update overload indicator if we are at root domain */
                set_rd_overloaded(env-&gt;dst_rq-&gt;rd, sg_status &amp; SG_OVERLOADED);

                /* Update over-utilization (tipping point, U &gt;= 0) indicator */
                set_rd_overutilized_status(env-&gt;dst_rq-&gt;rd,

Introduce separate sg_overloaded and sg_overutilized flags in update_sd_lb_stats()
and its lower level functions, and change all of them to 'bool'.

Remove the now unused SG_OVERLOADED and SG_OVERUTILIZED flags.

Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Acked-by: Shrikanth Hegde &lt;sshegde@linux.ibm.com&gt;
Tested-by: Shrikanth Hegde &lt;sshegde@linux.ibm.com&gt;
Cc: Qais Yousef &lt;qyousef@layalina.io&gt;
Cc: Vincent Guittot &lt;vincent.guittot@linaro.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/ZgVPhODZ8/nbsqbP@gmail.com
</content>
</entry>
<entry>
<title>sched/fair: Rename SG_OVERLOAD to SG_OVERLOADED</title>
<updated>2024-03-28T10:44:44Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2024-03-28T10:44:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7bda10ba7f453729f210264dd07d38989fb858d9'/>
<id>urn:sha1:7bda10ba7f453729f210264dd07d38989fb858d9</id>
<content type='text'>
Follow the rename of the root_domain::overloaded flag.

Note that this also matches the SG_OVERUTILIZED flag better.

Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Qais Yousef &lt;qyousef@layalina.io&gt;
Cc: Shrikanth Hegde &lt;sshegde@linux.ibm.com&gt;
Cc: Vincent Guittot &lt;vincent.guittot@linaro.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/ZgVHq65XKsOZpfgK@gmail.com
</content>
</entry>
<entry>
<title>sched/fair: Rename {set|get}_rd_overload() to {set|get}_rd_overloaded()</title>
<updated>2024-03-28T10:41:31Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2024-03-28T10:41:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=76cc4f91488af0a808bec97794bfe434dece7d67'/>
<id>urn:sha1:76cc4f91488af0a808bec97794bfe434dece7d67</id>
<content type='text'>
Follow the rename of the root_domain::overloaded flag.

Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Qais Yousef &lt;qyousef@layalina.io&gt;
Cc: Shrikanth Hegde &lt;sshegde@linux.ibm.com&gt;
Cc: Vincent Guittot &lt;vincent.guittot@linaro.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/ZgVHq65XKsOZpfgK@gmail.com
</content>
</entry>
<entry>
<title>sched/fair: Rename root_domain::overload to ::overloaded</title>
<updated>2024-03-28T10:38:58Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2024-03-28T10:33:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dfb83ef7b8b064c15be19cf7fcbde0996712de8f'/>
<id>urn:sha1:dfb83ef7b8b064c15be19cf7fcbde0996712de8f</id>
<content type='text'>
It is silly to use an ambiguous noun instead of a clear adjective when naming
such a flag ...

Note how root_domain::overutilized already used a proper adjective.

rd-&gt;overloaded is now set to 1 when the root domain is overloaded.

Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Qais Yousef &lt;qyousef@layalina.io&gt;
Cc: Shrikanth Hegde &lt;sshegde@linux.ibm.com&gt;
Cc: Vincent Guittot &lt;vincent.guittot@linaro.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/ZgVHq65XKsOZpfgK@gmail.com
</content>
</entry>
</feed>
