commit:     fb37cfcdccc624a501e7fc90e30d6a4efd549f6f
Author:     Arisu Tachibana <alicef <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 30 18:39:45 2025 +0000
Commit:     Arisu Tachibana <alicef <AT> gentoo <DOT> org>
CommitDate: Tue Dec 30 18:41:03 2025 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=fb37cfcd

Add patch 1810 sched/proxy: Yield the donor task

Ref: https://bugs.gentoo.org/968116
Signed-off-by: Arisu Tachibana <alicef <AT> gentoo.org>

 0000_README                                 |   4 +
 1810_sched_proxy_yield_the_donor_task.patch | 118 ++++++++++++++++++++++++++++
 2 files changed, 122 insertions(+)

diff --git a/0000_README b/0000_README
index c32c9ea8..c209b9cc 100644
--- a/0000_README
+++ b/0000_README
@@ -63,6 +63,10 @@ Patch:  1730_parisc-Disable-prctl.patch
 From:   https://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git
 Desc:   prctl: Temporarily disable prctl(PR_SET_MDWE) on parisc
 
+Patch:  1810_sched_proxy_yield_the_donor_task.patch
+From:   
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id=127b90315ca07ccad2618db7ba950a63e3b32d22
+Desc:   sched/proxy: Yield the donor task
+
 Patch:  2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch
 From:   
https://lore.kernel.org/linux-bluetooth/[email protected]/raw
 Desc:   Bluetooth: Check key sizes only when Secure Simple Pairing is enabled. 
See bug #686758

diff --git a/1810_sched_proxy_yield_the_donor_task.patch 
b/1810_sched_proxy_yield_the_donor_task.patch
new file mode 100644
index 00000000..381b96e5
--- /dev/null
+++ b/1810_sched_proxy_yield_the_donor_task.patch
@@ -0,0 +1,118 @@
+From 127b90315ca07ccad2618db7ba950a63e3b32d22 Mon Sep 17 00:00:00 2001
+From: Fernand Sieber <[email protected]>
+Date: Thu, 6 Nov 2025 12:40:10 +0200
+Subject: sched/proxy: Yield the donor task
+
+When executing a task in proxy context, handle yields as if they were
+requested by the donor task. This matches the traditional PI semantics
+of yield() as well.
+
+This avoids scenario like proxy task yielding, pick next task selecting the
+same previous blocked donor, running the proxy task again, etc.
+
+Reported-by: kernel test robot <[email protected]>
+Closes: https://lore.kernel.org/oe-lkp/[email protected]
+Suggested-by: Peter Zijlstra <[email protected]>
+Signed-off-by: Fernand Sieber <[email protected]>
+Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
+Link: https://patch.msgid.link/[email protected]
+---
+ kernel/sched/deadline.c | 2 +-
+ kernel/sched/ext.c      | 4 ++--
+ kernel/sched/fair.c     | 2 +-
+ kernel/sched/rt.c       | 2 +-
+ kernel/sched/syscalls.c | 5 +++--
+ 5 files changed, 8 insertions(+), 7 deletions(-)
+
+diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
+index 6b8a9286e2fca2..13112c680f9228 100644
+--- a/kernel/sched/deadline.c
++++ b/kernel/sched/deadline.c
+@@ -2143,7 +2143,7 @@ static void yield_task_dl(struct rq *rq)
+        * it and the bandwidth timer will wake it up and will give it
+        * new scheduling parameters (thanks to dl_yielded=1).
+        */
+-      rq->curr->dl.dl_yielded = 1;
++      rq->donor->dl.dl_yielded = 1;
+ 
+       update_rq_clock(rq);
+       update_curr_dl(rq);
+diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
+index b063444dc003f9..224b72c8e8da94 100644
+--- a/kernel/sched/ext.c
++++ b/kernel/sched/ext.c
+@@ -1474,7 +1474,7 @@ static bool dequeue_task_scx(struct rq *rq, struct 
task_struct *p, int deq_flags
+ static void yield_task_scx(struct rq *rq)
+ {
+       struct scx_sched *sch = scx_root;
+-      struct task_struct *p = rq->curr;
++      struct task_struct *p = rq->donor;
+ 
+       if (SCX_HAS_OP(sch, yield))
+               SCX_CALL_OP_2TASKS_RET(sch, SCX_KF_REST, yield, rq, p, NULL);
+@@ -1485,7 +1485,7 @@ static void yield_task_scx(struct rq *rq)
+ static bool yield_to_task_scx(struct rq *rq, struct task_struct *to)
+ {
+       struct scx_sched *sch = scx_root;
+-      struct task_struct *from = rq->curr;
++      struct task_struct *from = rq->donor;
+ 
+       if (SCX_HAS_OP(sch, yield))
+               return SCX_CALL_OP_2TASKS_RET(sch, SCX_KF_REST, yield, rq,
+diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
+index 273e2871b59e70..f1d8eb350f595f 100644
+--- a/kernel/sched/fair.c
++++ b/kernel/sched/fair.c
+@@ -8980,7 +8980,7 @@ static void put_prev_task_fair(struct rq *rq, struct 
task_struct *prev, struct t
+  */
+ static void yield_task_fair(struct rq *rq)
+ {
+-      struct task_struct *curr = rq->curr;
++      struct task_struct *curr = rq->donor;
+       struct cfs_rq *cfs_rq = task_cfs_rq(curr);
+       struct sched_entity *se = &curr->se;
+ 
+diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
+index 1fd97f2d7ec628..f1867fe8e5c535 100644
+--- a/kernel/sched/rt.c
++++ b/kernel/sched/rt.c
+@@ -1490,7 +1490,7 @@ static void requeue_task_rt(struct rq *rq, struct 
task_struct *p, int head)
+ 
+ static void yield_task_rt(struct rq *rq)
+ {
+-      requeue_task_rt(rq, rq->curr, 0);
++      requeue_task_rt(rq, rq->donor, 0);
+ }
+ 
+ static int find_lowest_rq(struct task_struct *task);
+diff --git a/kernel/sched/syscalls.c b/kernel/sched/syscalls.c
+index 8f0f603b530bef..807879131add85 100644
+--- a/kernel/sched/syscalls.c
++++ b/kernel/sched/syscalls.c
+@@ -1319,7 +1319,7 @@ static void do_sched_yield(void)
+       rq = this_rq_lock_irq(&rf);
+ 
+       schedstat_inc(rq->yld_count);
+-      current->sched_class->yield_task(rq);
++      rq->donor->sched_class->yield_task(rq);
+ 
+       preempt_disable();
+       rq_unlock_irq(rq, &rf);
+@@ -1388,12 +1388,13 @@ EXPORT_SYMBOL(yield);
+  */
+ int __sched yield_to(struct task_struct *p, bool preempt)
+ {
+-      struct task_struct *curr = current;
++      struct task_struct *curr;
+       struct rq *rq, *p_rq;
+       int yielded = 0;
+ 
+       scoped_guard (raw_spinlock_irqsave, &p->pi_lock) {
+               rq = this_rq();
++              curr = rq->donor;
+ 
+ again:
+               p_rq = task_rq(p);
+-- 
+cgit 1.2.3-korg
+

Reply via email to