Skip to content

Commit 09bcd5e

Browse files
committed
Merge tag 'sched-urgent-2025-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler fixes from Ingo Molnar: "Miscellaneous scheduler fixes/cleanups: - Fix psi_dequeue() for Proxy Execution - Fix hrtick() vs. scheduling context bug - Fix unfairness caused by stalled tg_load_avg_contrib when the last task migrates out - Fix whitespace noise in headers - Remove a preempt-disable section in rt_mutex_setprio()" * tag 'sched-urgent-2025-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: sched/core: Fix psi_dequeue() for Proxy Execution sched/fair: Fix unfairness caused by stalled tg_load_avg_contrib when the last task migrates out sched/rt: Remove a preempt-disable section in rt_mutex_setprio() sched/hrtick: Fix hrtick() vs. scheduling context sched/headers: Remove whitespace noise from kernel/sched/sched.h
2 parents 08b8dda + c2ae8b0 commit 09bcd5e

4 files changed

Lines changed: 12 additions & 7 deletions

File tree

kernel/sched/core.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ static enum hrtimer_restart hrtick(struct hrtimer *timer)
878878

879879
rq_lock(rq, &rf);
880880
update_rq_clock(rq);
881-
rq->donor->sched_class->task_tick(rq, rq->curr, 1);
881+
rq->donor->sched_class->task_tick(rq, rq->donor, 1);
882882
rq_unlock(rq, &rf);
883883

884884
return HRTIMER_NORESTART;
@@ -7360,15 +7360,12 @@ void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task)
73607360
p->prio = prio;
73617361
}
73627362
out_unlock:
7363-
/* Avoid rq from going away on us: */
7364-
preempt_disable();
7363+
/* Caller holds task_struct::pi_lock, IRQs are still disabled */
73657364

73667365
rq_unpin_lock(rq, &rf);
73677366
__balance_callbacks(rq);
73687367
rq_repin_lock(rq, &rf);
73697368
__task_rq_unlock(rq, p, &rf);
7370-
7371-
preempt_enable();
73727369
}
73737370
#endif /* CONFIG_RT_MUTEXES */
73747371

kernel/sched/fair.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4034,6 +4034,9 @@ static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq)
40344034
if (child_cfs_rq_on_list(cfs_rq))
40354035
return false;
40364036

4037+
if (cfs_rq->tg_load_avg_contrib)
4038+
return false;
4039+
40374040
return true;
40384041
}
40394042

kernel/sched/sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ struct rq {
11671167
* one CPU and if it got migrated afterwards it may decrease
11681168
* it on another CPU. Always updated under the runqueue lock:
11691169
*/
1170-
unsigned long nr_uninterruptible;
1170+
unsigned long nr_uninterruptible;
11711171

11721172
#ifdef CONFIG_SCHED_PROXY_EXEC
11731173
struct task_struct __rcu *donor; /* Scheduling context */

kernel/sched/stats.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,13 @@ static inline void psi_dequeue(struct task_struct *p, int flags)
180180
* avoid walking all ancestors twice, psi_task_switch() handles
181181
* TSK_RUNNING and TSK_IOWAIT for us when it moves TSK_ONCPU.
182182
* Do nothing here.
183+
*
184+
* In the SCHED_PROXY_EXECUTION case we may do sleeping
185+
* dequeues that are not followed by a task switch, so check
186+
* TSK_ONCPU is set to ensure the task switch is imminent.
187+
* Otherwise clear the flags as usual.
183188
*/
184-
if (flags & DEQUEUE_SLEEP)
189+
if ((flags & DEQUEUE_SLEEP) && (p->psi_flags & TSK_ONCPU))
185190
return;
186191

187192
/*

0 commit comments

Comments
 (0)