<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/sched/cpupri.c, branch linux-6.0.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.0.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.0.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-02-23T09:58:33Z</updated>
<entry>
<title>sched/headers: Introduce kernel/sched/build_utility.c and build multiple .c files there</title>
<updated>2022-02-23T09:58:33Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2022-02-22T12:23:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=801c141955108fb7cf1244dda76e6de8b16fd3ae'/>
<id>urn:sha1:801c141955108fb7cf1244dda76e6de8b16fd3ae</id>
<content type='text'>
Collect all utility functionality source code files into a single kernel/sched/build_utility.c file,
via #include-ing the .c files:

    kernel/sched/clock.c
    kernel/sched/completion.c
    kernel/sched/loadavg.c
    kernel/sched/swait.c
    kernel/sched/wait_bit.c
    kernel/sched/wait.c

CONFIG_CPU_FREQ:
    kernel/sched/cpufreq.c

CONFIG_CPU_FREQ_GOV_SCHEDUTIL:
    kernel/sched/cpufreq_schedutil.c

CONFIG_CGROUP_CPUACCT:
    kernel/sched/cpuacct.c

CONFIG_SCHED_DEBUG:
    kernel/sched/debug.c

CONFIG_SCHEDSTATS:
    kernel/sched/stats.c

CONFIG_SMP:
   kernel/sched/cpupri.c
   kernel/sched/stop_task.c
   kernel/sched/topology.c

CONFIG_SCHED_CORE:
   kernel/sched/core_sched.c

CONFIG_PSI:
   kernel/sched/psi.c

CONFIG_MEMBARRIER:
   kernel/sched/membarrier.c

CONFIG_CPU_ISOLATION:
   kernel/sched/isolation.c

CONFIG_SCHED_AUTOGROUP:
   kernel/sched/autogroup.c

The goal is to amortize the 60+ KLOC header bloat from over a dozen build units into
a single build unit.

The build time of build_utility.c also roughly matches the build time of core.c and
fair.c - allowing better load-balancing of scheduler-only rebuilds.

Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Reviewed-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
</content>
</entry>
<entry>
<title>sched: Fix various typos</title>
<updated>2021-03-21T23:11:52Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2021-03-18T12:38:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3b03706fa621ce31a3e9ef6307020fde4e6aae16'/>
<id>urn:sha1:3b03706fa621ce31a3e9ef6307020fde4e6aae16</id>
<content type='text'>
Fix ~42 single-word typos in scheduler code comments.

We have accumulated a few fun ones over the years. :-)

Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Mike Galbraith &lt;efault@gmx.de&gt;
Cc: Juri Lelli &lt;juri.lelli@redhat.com&gt;
Cc: Vincent Guittot &lt;vincent.guittot@linaro.org&gt;
Cc: Dietmar Eggemann &lt;dietmar.eggemann@arm.com&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Ben Segall &lt;bsegall@google.com&gt;
Cc: Mel Gorman &lt;mgorman@suse.de&gt;
Cc: linux-kernel@vger.kernel.org
</content>
</entry>
<entry>
<title>Merge branch 'sched/migrate-disable'</title>
<updated>2020-11-10T17:39:04Z</updated>
<author>
<name>Peter Zijlstra</name>
</author>
<published>2020-11-10T17:39:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=12fa97c64dce2f3c2e6eed5dc618bb9046e40bf0'/>
<id>urn:sha1:12fa97c64dce2f3c2e6eed5dc618bb9046e40bf0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sched,rt: Use the full cpumask for balancing</title>
<updated>2020-11-10T17:39:00Z</updated>
<author>
<name>Peter Zijlstra</name>
</author>
<published>2020-10-01T14:05:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=95158a89dd50035b4ff5b8aa913854166b50fe6d'/>
<id>urn:sha1:95158a89dd50035b4ff5b8aa913854166b50fe6d</id>
<content type='text'>
We want migrate_disable() tasks to get PULLs in order for them to PUSH
away the higher priority task.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Valentin Schneider &lt;valentin.schneider@arm.com&gt;
Reviewed-by: Daniel Bristot de Oliveira &lt;bristot@redhat.com&gt;
Link: https://lkml.kernel.org/r/20201023102347.310519774@infradead.org
</content>
</entry>
<entry>
<title>sched/cpupri: Add CPUPRI_HIGHER</title>
<updated>2020-10-29T10:00:30Z</updated>
<author>
<name>Peter Zijlstra</name>
</author>
<published>2020-10-14T19:39:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b13772f8135633f273f0cf742143b19cffbf9e1d'/>
<id>urn:sha1:b13772f8135633f273f0cf742143b19cffbf9e1d</id>
<content type='text'>
Add CPUPRI_HIGHER above the RT99 priority to denote the CPU is in use
by higher priority tasks (specifically deadline).

XXX: we should probably drive PUSH-PULL from cpupri, that would
automagically result in an RT-PUSH when DL sets cpupri to CPUPRI_HIGHER.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Dietmar Eggemann &lt;dietmar.eggemann@arm.com&gt;
</content>
</entry>
<entry>
<title>sched/cpupri: Remap CPUPRI_NORMAL to MAX_RT_PRIO-1</title>
<updated>2020-10-29T10:00:30Z</updated>
<author>
<name>Peter Zijlstra</name>
</author>
<published>2020-10-14T19:06:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=934fc3314b39e16a89fc4d5d0d5cbfe71dcbe7b1'/>
<id>urn:sha1:934fc3314b39e16a89fc4d5d0d5cbfe71dcbe7b1</id>
<content type='text'>
This makes the mapping continuous and frees up 100 for other usage.

Prev mapping:

p-&gt;rt_priority   p-&gt;prio   newpri   cpupri

                               -1       -1 (CPUPRI_INVALID)

                              100        0 (CPUPRI_NORMAL)

             1        98       98        1
           ...
            49        50       50       49
            50        49       49       50
           ...
            99         0        0       99

New mapping:

p-&gt;rt_priority   p-&gt;prio   newpri   cpupri

                               -1       -1 (CPUPRI_INVALID)

                               99        0 (CPUPRI_NORMAL)

             1        98       98        1
           ...
            49        50       50       49
            50        49       49       50
           ...
            99         0        0       99

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Dietmar Eggemann &lt;dietmar.eggemann@arm.com&gt;
</content>
</entry>
<entry>
<title>sched/cpupri: Remove pri_to_cpu[1]</title>
<updated>2020-10-29T10:00:29Z</updated>
<author>
<name>Dietmar Eggemann</name>
</author>
<published>2020-09-22T08:39:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1b08782ce31f612d98e11ccccf3e3df9a147a67d'/>
<id>urn:sha1:1b08782ce31f612d98e11ccccf3e3df9a147a67d</id>
<content type='text'>
pri_to_cpu[1] isn't used since cpupri_set(..., newpri) is
never called with newpri = 99.

The valid RT priorities RT1..RT99 (p-&gt;rt_priority = [1..99]) map into
cpupri (idx of pri_to_cpu[]) = [2..100]

Current mapping:

p-&gt;rt_priority   p-&gt;prio   newpri   cpupri

                               -1       -1 (CPUPRI_INVALID)

                              100        0 (CPUPRI_NORMAL)

             1        98       98        2
           ...
            49        50       50       50
            50        49       49       51
           ...
            99         0        0      100

So cpupri = 1 isn't used.

Reduce the size of pri_to_cpu[] by 1 and adapt the cpupri
implementation accordingly. This will save a useless for loop with an
atomic_read in cpupri_find_fitness() calling __cpupri_find().

New mapping:

p-&gt;rt_priority   p-&gt;prio   newpri   cpupri

                               -1       -1 (CPUPRI_INVALID)

                              100        0 (CPUPRI_NORMAL)

             1        98       98        1
           ...
            49        50       50       49
            50        49       49       50
           ...
            99         0        0       99

Signed-off-by: Dietmar Eggemann &lt;dietmar.eggemann@arm.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20200922083934.19275-3-dietmar.eggemann@arm.com
</content>
</entry>
<entry>
<title>sched/cpupri: Remove pri_to_cpu[CPUPRI_IDLE]</title>
<updated>2020-10-29T10:00:29Z</updated>
<author>
<name>Dietmar Eggemann</name>
</author>
<published>2020-09-22T08:39:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5e054bca44fe92323de5e9b71478d1904b8bb1b7'/>
<id>urn:sha1:5e054bca44fe92323de5e9b71478d1904b8bb1b7</id>
<content type='text'>
pri_to_cpu[CPUPRI_IDLE=0] isn't used since cpupri_set(..., newpri) is
never called with newpri = MAX_PRIO (140).

Current mapping:

p-&gt;rt_priority   p-&gt;prio   newpri   cpupri

                               -1       -1 (CPUPRI_INVALID)

                              140        0 (CPUPRI_IDLE)

                              100        1 (CPUPRI_NORMAL)

             1        98       98        3
           ...
            49        50       50       51
            50        49       49       52
           ...
            99         0        0      101

Even when cpupri was introduced with commit 6e0534f27819 ("sched: use a
2-d bitmap for searching lowest-pri CPU") in v2.6.27, only

   (1) CPUPRI_INVALID (-1),
   (2) MAX_RT_PRIO (100),
   (3) an RT prio (RT1..RT99)

were used as newprio in cpupri_set(..., newpri) -&gt; convert_prio(newpri).

MAX_RT_PRIO is used only in dec_rt_tasks() -&gt; dec_rt_prio() -&gt;
dec_rt_prio_smp() -&gt; cpupri_set() in case of !rt_rq-&gt;rt_nr_running.
I.e. it stands for a non-rt task, including the IDLE task.

Commit 57785df5ac53 ("sched: Fix task priority bug") removed code in
v2.6.33 which did set the priority of the IDLE task to MAX_PRIO.
Although this happened after the introduction of cpupri, it didn't have
an effect on the values used for cpupri_set(..., newpri).

Remove CPUPRI_IDLE and adapt the cpupri implementation accordingly.
This will save a useless for loop with an atomic_read in
cpupri_find_fitness() calling __cpupri_find().

New mapping:

p-&gt;rt_priority   p-&gt;prio   newpri   cpupri

                               -1       -1 (CPUPRI_INVALID)

                              100        0 (CPUPRI_NORMAL)

             1        98       98        2
           ...
            49        50       50       50
            50        49       49       51
           ...
            99         0        0      100

Signed-off-by: Dietmar Eggemann &lt;dietmar.eggemann@arm.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20200922083934.19275-2-dietmar.eggemann@arm.com
</content>
</entry>
<entry>
<title>sched/rt: cpupri_find: Trigger a full search as fallback</title>
<updated>2020-03-20T12:06:20Z</updated>
<author>
<name>Qais Yousef</name>
</author>
<published>2020-03-05T10:24:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e94f80f6c49020008e6fa0f3d4b806b8595d17d8'/>
<id>urn:sha1:e94f80f6c49020008e6fa0f3d4b806b8595d17d8</id>
<content type='text'>
If we failed to find a fitting CPU, in cpupri_find(), we only fallback
to the level we found a hit at.

But Steve suggested to fallback to a second full scan instead as this
could be a better effort.

	https://lore.kernel.org/lkml/20200304135404.146c56eb@gandalf.local.home/

We trigger the 2nd search unconditionally since the argument about
triggering a full search is that the recorded fall back level might have
become empty by then. Which means storing any data about what happened
would be meaningless and stale.

I had a humble try at timing it and it seemed okay for the small 6 CPUs
system I was running on

	https://lore.kernel.org/lkml/20200305124324.42x6ehjxbnjkklnh@e107158-lin.cambridge.arm.com/

On large system this second full scan could be expensive. But there are
no users outside capacity awareness for this fitness function at the
moment. Heterogeneous systems tend to be small with 8cores in total.

Suggested-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Qais Yousef &lt;qais.yousef@arm.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
Link: https://lkml.kernel.org/r/20200310142219.syxzn5ljpdxqtbgx@e107158-lin.cambridge.arm.com
</content>
</entry>
<entry>
<title>sched/rt: Optimize cpupri_find() on non-heterogenous systems</title>
<updated>2020-03-06T11:57:27Z</updated>
<author>
<name>Qais Yousef</name>
</author>
<published>2020-03-02T13:27:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a1bd02e1f28b1939cac8c64072a0e578c3cbc345'/>
<id>urn:sha1:a1bd02e1f28b1939cac8c64072a0e578c3cbc345</id>
<content type='text'>
By introducing a new cpupri_find_fitness() function that takes the
fitness_fn as an argument and only called when asym_system static key is
enabled.

cpupri_find() is now a wrapper function that calls cpupri_find_fitness()
passing NULL as a fitness_fn, hence disabling the logic that handles
fitness by default.

LINK: https://lore.kernel.org/lkml/c0772fca-0a4b-c88d-fdf2-5715fcf8447b@arm.com/
Reported-by: Dietmar Eggemann &lt;dietmar.eggemann@arm.com&gt;
Signed-off-by: Qais Yousef &lt;qais.yousef@arm.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Fixes: 804d402fb6f6 ("sched/rt: Make RT capacity-aware")
Link: https://lkml.kernel.org/r/20200302132721.8353-4-qais.yousef@arm.com
</content>
</entry>
</feed>
