<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/sched/deadline.c, branch linux-6.4.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.4.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.4.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-08-30T12:52:39Z</updated>
<entry>
<title>sched/deadline: Create DL BW alloc, free &amp; check overflow interface</title>
<updated>2023-08-30T12:52:39Z</updated>
<author>
<name>Dietmar Eggemann</name>
</author>
<published>2023-08-21T22:19:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d1cfa53e5e4e4c8f5ed31c1a8a979b5f4a161a17'/>
<id>urn:sha1:d1cfa53e5e4e4c8f5ed31c1a8a979b5f4a161a17</id>
<content type='text'>
commit 85989106feb734437e2d598b639991b9185a43a6 upstream.

While moving a set of tasks between exclusive cpusets,
cpuset_can_attach() -&gt; task_can_attach() calls dl_cpu_busy(..., p) for
DL BW overflow checking and per-task DL BW allocation on the destination
root_domain for the DL tasks in this set.

This approach has the issue of not freeing already allocated DL BW in
the following error cases:

(1) The set of tasks includes multiple DL tasks and DL BW overflow
    checking fails for one of the subsequent DL tasks.

(2) Another controller next to the cpuset controller which is attached
    to the same cgroup fails in its can_attach().

To address this problem rework dl_cpu_busy():

(1) Split it into dl_bw_check_overflow() &amp; dl_bw_alloc() and add a
    dedicated dl_bw_free().

(2) dl_bw_alloc() &amp; dl_bw_free() take a `u64 dl_bw` parameter instead of
    a `struct task_struct *p` used in dl_cpu_busy(). This allows to
    allocate DL BW for a set of tasks too rather than only for a single
    task.

Signed-off-by: Dietmar Eggemann &lt;dietmar.eggemann@arm.com&gt;
Signed-off-by: Juri Lelli &lt;juri.lelli@redhat.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Qais Yousef (Google) &lt;qyousef@layalina.io&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>sched/cpuset: Keep track of SCHED_DEADLINE task in cpusets</title>
<updated>2023-08-30T12:52:38Z</updated>
<author>
<name>Juri Lelli</name>
</author>
<published>2023-08-21T22:19:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=74fac5bb0d375d6b8f5e7997925063c509089c9c'/>
<id>urn:sha1:74fac5bb0d375d6b8f5e7997925063c509089c9c</id>
<content type='text'>
commit 6c24849f5515e4966d94fa5279bdff4acf2e9489 upstream.

Qais reported that iterating over all tasks when rebuilding root domains
for finding out which ones are DEADLINE and need their bandwidth
correctly restored on such root domains can be a costly operation (10+
ms delays on suspend-resume).

To fix the problem keep track of the number of DEADLINE tasks belonging
to each cpuset and then use this information (followup patch) to only
perform the above iteration if DEADLINE tasks are actually present in
the cpuset for which a corresponding root domain is being rebuilt.

Reported-by: Qais Yousef (Google) &lt;qyousef@layalina.io&gt;
Link: https://lore.kernel.org/lkml/20230206221428.2125324-1-qyousef@layalina.io/
Signed-off-by: Juri Lelli &lt;juri.lelli@redhat.com&gt;
Reviewed-by: Waiman Long &lt;longman@redhat.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Qais Yousef (Google) &lt;qyousef@layalina.io&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>sched/rt: Fix bad task migration for rt tasks</title>
<updated>2023-04-21T11:24:21Z</updated>
<author>
<name>Schspa Shi</name>
</author>
<published>2022-08-28T17:03:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=feffe5bb274dd3442080ef0e4053746091878799'/>
<id>urn:sha1:feffe5bb274dd3442080ef0e4053746091878799</id>
<content type='text'>
Commit 95158a89dd50 ("sched,rt: Use the full cpumask for balancing")
allows find_lock_lowest_rq() to pick a task with migration disabled.
The purpose of the commit is to push the current running task on the
CPU that has the migrate_disable() task away.

However, there is a race which allows a migrate_disable() task to be
migrated. Consider:

  CPU0                                    CPU1
  push_rt_task
    check is_migration_disabled(next_task)

                                          task not running and
                                          migration_disabled == 0

    find_lock_lowest_rq(next_task, rq);
      _double_lock_balance(this_rq, busiest);
        raw_spin_rq_unlock(this_rq);
        double_rq_lock(this_rq, busiest);
          &lt;&lt;wait for busiest rq&gt;&gt;
                                              &lt;wakeup&gt;
                                          task become running
                                          migrate_disable();
                                            &lt;context out&gt;
    deactivate_task(rq, next_task, 0);
    set_task_cpu(next_task, lowest_rq-&gt;cpu);
      WARN_ON_ONCE(is_migration_disabled(p));

Fixes: 95158a89dd50 ("sched,rt: Use the full cpumask for balancing")
Signed-off-by: Schspa Shi &lt;schspa@gmail.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
Reviewed-by: Dietmar Eggemann &lt;dietmar.eggemann@arm.com&gt;
Reviewed-by: Valentin Schneider &lt;vschneid@redhat.com&gt;
Tested-by: Dwaine Gonyier &lt;dgonyier@redhat.com&gt;
</content>
</entry>
<entry>
<title>sched/core: Avoid selecting the task that is throttled to run when core-sched enable</title>
<updated>2023-03-22T09:10:58Z</updated>
<author>
<name>Hao Jia</name>
</author>
<published>2023-03-16T08:18:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=530bfad1d53d103f98cec66a3e491a36d397884d'/>
<id>urn:sha1:530bfad1d53d103f98cec66a3e491a36d397884d</id>
<content type='text'>
When {rt, cfs}_rq or dl task is throttled, since cookied tasks
are not dequeued from the core tree, So sched_core_find() and
sched_core_next() may return throttled task, which may
cause throttled task to run on the CPU.

So we add checks in sched_core_find() and sched_core_next()
to make sure that the return is a runnable task that is
not throttled.

Co-developed-by: Cruz Zhao &lt;CruzZhao@linux.alibaba.com&gt;
Signed-off-by: Cruz Zhao &lt;CruzZhao@linux.alibaba.com&gt;
Signed-off-by: Hao Jia &lt;jiahao.os@bytedance.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20230316081806.69544-1-jiahao.os@bytedance.com
</content>
</entry>
<entry>
<title>sched/deadline: Add more reschedule cases to prio_changed_dl()</title>
<updated>2023-02-11T10:18:10Z</updated>
<author>
<name>Valentin Schneider</name>
</author>
<published>2023-02-06T14:06:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7ea98dfa44917a201e76d4fe96bf61d76e60f524'/>
<id>urn:sha1:7ea98dfa44917a201e76d4fe96bf61d76e60f524</id>
<content type='text'>
I've been tracking down an issue on a ~5.17ish kernel where:

  CPUx                           CPUy

  &lt;DL task p0 owns an rtmutex M&gt;
  &lt;p0 depletes its runtime, gets throttled&gt;
  &lt;rq switches to the idle task&gt;
				 &lt;DL task p1 blocks on M, boost/replenish p0&gt;
				 &lt;No call to resched_curr() happens here&gt;

  [idle task keeps running here until *something*
   accidentally sets TIF_NEED_RESCHED]

On that kernel, it is quite easy to trigger using rt-tests's deadline_test
[1] with the test running on isolated CPUs (this reduces the chance of
something unrelated setting TIF_NEED_RESCHED on the idle tasks, making the
issue even more obvious as the hung task detector chimes in).

I haven't been able to reproduce this using a mainline kernel, even if I
revert

  2972e3050e35 ("tracing: Make trace_marker{,_raw} stream-like")

which gets rid of the lock involved in the above test, *but* I cannot
convince myself the issue isn't there from looking at the code.

Make prio_changed_dl() issue a reschedule if the current task isn't a
deadline one. While at it, ensure a reschedule is emitted when a
queued-but-not-current task gets boosted with an earlier deadline that
current's.

[1]: https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git

Signed-off-by: Valentin Schneider &lt;vschneid@redhat.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Acked-by: Juri Lelli &lt;juri.lelli@redhat.com&gt;
Link: https://lore.kernel.org/r/20230206140612.701871-1-vschneid@redhat.com
</content>
</entry>
<entry>
<title>sched: Introduce affinity_context</title>
<updated>2022-10-27T09:01:21Z</updated>
<author>
<name>Waiman Long</name>
</author>
<published>2022-09-22T18:00:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=713a2e21a5137e96d2594f53d19784ffde3ddbd0'/>
<id>urn:sha1:713a2e21a5137e96d2594f53d19784ffde3ddbd0</id>
<content type='text'>
In order to prepare for passing through additional data through the
affinity call-chains, convert the mask and flags argument into a
structure.

Suggested-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20220922180041.1768141-5-longman@redhat.com
</content>
</entry>
<entry>
<title>sched: Introduce struct balance_callback to avoid CFI mismatches</title>
<updated>2022-10-17T14:41:25Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2022-10-08T00:07:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8e5bad7dccec2014f24497b57d8a8ee0b752c290'/>
<id>urn:sha1:8e5bad7dccec2014f24497b57d8a8ee0b752c290</id>
<content type='text'>
Introduce distinct struct balance_callback instead of performing function
pointer casting which will trip CFI. Avoids warnings as found by Clang's
future -Wcast-function-type-strict option:

In file included from kernel/sched/core.c:84:
kernel/sched/sched.h:1755:15: warning: cast from 'void (*)(struct rq *)' to 'void (*)(struct callback_head *)' converts to incompatible function type [-Wcast-function-type-strict]
        head-&gt;func = (void (*)(struct callback_head *))func;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

No binary differences result from this change.

This patch is a cleanup based on Brad Spengler/PaX Team's modifications
to sched code in their last public patch of grsecurity/PaX based on my
understanding of the code. Changes or omissions from the original code
are mine and don't reflect the original grsecurity/PaX code.

Reported-by: Sami Tolvanen &lt;samitolvanen@google.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Link: https://github.com/ClangBuiltLinux/linux/issues/1724
Link: https://lkml.kernel.org/r/20221008000758.2957718-1-keescook@chromium.org
</content>
</entry>
<entry>
<title>sched: Rename task_running() to task_on_cpu()</title>
<updated>2022-09-07T19:53:47Z</updated>
<author>
<name>Peter Zijlstra</name>
</author>
<published>2022-09-06T10:33:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0b9d46fc5ef7a457cc635b30b010081228cb81ac'/>
<id>urn:sha1:0b9d46fc5ef7a457cc635b30b010081228cb81ac</id>
<content type='text'>
There is some ambiguity about task_running() in that it is unrelated
to TASK_RUNNING but instead tests -&gt;on_cpu. As such, rename the thing
task_on_cpu().

Suggested-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/Yxhkhn55uHZx+NGl@hirez.programming.kicks-ass.net
</content>
</entry>
<entry>
<title>sched/deadline: Move __dl_clear_params out of dl_bw lock</title>
<updated>2022-09-01T09:19:55Z</updated>
<author>
<name>Shang XiaoJing</name>
</author>
<published>2022-08-27T02:09:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=33f93525799fa3c841b2ba93a56b2bb32ab11dc9'/>
<id>urn:sha1:33f93525799fa3c841b2ba93a56b2bb32ab11dc9</id>
<content type='text'>
As members in sched_dl_entity are independent with dl_bw, move
__dl_clear_params out of dl_bw lock.

Signed-off-by: Shang XiaoJing &lt;shangxiaojing@huawei.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Daniel Bristot de Oliveira &lt;bristot@kernel.org&gt;
Link: https://lore.kernel.org/r/20220827020911.30641-1-shangxiaojing@huawei.com
</content>
</entry>
<entry>
<title>sched/deadline: Add replenish_dl_new_period helper</title>
<updated>2022-09-01T09:19:54Z</updated>
<author>
<name>Shang XiaoJing</name>
</author>
<published>2022-08-26T10:00:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=96458e7f7dc5ad14bd7577cbf1638e1504ad79dd'/>
<id>urn:sha1:96458e7f7dc5ad14bd7577cbf1638e1504ad79dd</id>
<content type='text'>
Wrap repeated code in helper function replenish_dl_new_period, which set
the deadline and runtime of input dl_se based on pi_of(dl_se). Note that
setup_new_dl_entity originally set the deadline and runtime base on
dl_se, which should equals to pi_of(dl_se) for non-boosted task.

Signed-off-by: Shang XiaoJing &lt;shangxiaojing@huawei.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Daniel Bristot de Oliveira &lt;bristot@kernel.org&gt;
Link: https://lore.kernel.org/r/20220826100037.12146-1-shangxiaojing@huawei.com
</content>
</entry>
</feed>
