Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'sched-urgent-2026-05-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:

- Fix the delayed dequeue negative lag increase fix in the
fair scheduler (Peter Zijlstra)

- Fix wakeup_preempt_fair() to do proper delayed dequeue
(Vincent Guittot)

- Clear sched_entity::rel_deadline when initializing
forked entities, which bug can cause all tasks to be
EEVDF-ineligible, causing a NULL pointer dereference
crash in pick_next_entity() (Zicheng Qu)

* tag 'sched-urgent-2026-05-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
sched/fair: Clear rel_deadline when initializing forked entities
sched/fair: Fix wakeup_preempt_fair() vs delayed dequeue
sched/fair: Fix the negative lag increase fix

+26 -19
+1
kernel/sched/core.c
··· 4458 4458 p->se.nr_migrations = 0; 4459 4459 p->se.vruntime = 0; 4460 4460 p->se.vlag = 0; 4461 + p->se.rel_deadline = 0; 4461 4462 INIT_LIST_HEAD(&p->se.group_node); 4462 4463 4463 4464 /* A delayed task cannot be in clone(). */
+25 -19
kernel/sched/fair.c
··· 847 847 * Similarly, check that the entity didn't gain positive lag when DELAY_ZERO 848 848 * is set. 849 849 * 850 - * Return true if the lag has been adjusted. 850 + * Return true if the vlag has been modified. Specifically: 851 + * 852 + * se->vlag != avg_vruntime() - se->vruntime 853 + * 854 + * This can be due to clamping in entity_lag() or clamping due to 855 + * sched_delayed. Either way, when vlag is modified and the entity is 856 + * retained, the tree needs to be adjusted. 851 857 */ 852 858 static __always_inline 853 859 bool update_entity_lag(struct cfs_rq *cfs_rq, struct sched_entity *se) 854 860 { 855 - s64 vlag = entity_lag(cfs_rq, se, avg_vruntime(cfs_rq)); 856 - bool ret; 861 + u64 avruntime = avg_vruntime(cfs_rq); 862 + s64 vlag = entity_lag(cfs_rq, se, avruntime); 857 863 858 864 WARN_ON_ONCE(!se->on_rq); 859 865 ··· 869 863 if (sched_feat(DELAY_ZERO)) 870 864 vlag = min(vlag, 0); 871 865 } 872 - ret = (vlag == se->vlag); 873 866 se->vlag = vlag; 874 867 875 - return ret; 868 + return avruntime - vlag != se->vruntime; 876 869 } 877 870 878 871 /* ··· 1104 1099 * 1105 1100 * Which allows tree pruning through eligibility. 1106 1101 */ 1107 - static struct sched_entity *__pick_eevdf(struct cfs_rq *cfs_rq, bool protect) 1102 + static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq, bool protect) 1108 1103 { 1109 1104 struct rb_node *node = cfs_rq->tasks_timeline.rb_root.rb_node; 1110 1105 struct sched_entity *se = __pick_first_entity(cfs_rq); ··· 1173 1168 best = curr; 1174 1169 1175 1170 return best; 1176 - } 1177 - 1178 - static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq) 1179 - { 1180 - return __pick_eevdf(cfs_rq, true); 1181 1171 } 1182 1172 1183 1173 struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq) ··· 5749 5749 * 4) do not run the "skip" process, if something else is available 5750 5750 */ 5751 5751 static struct sched_entity * 5752 - pick_next_entity(struct rq *rq, struct cfs_rq *cfs_rq) 5752 + pick_next_entity(struct rq *rq, struct cfs_rq *cfs_rq, bool protect) 5753 5753 { 5754 5754 struct sched_entity *se; 5755 5755 5756 - se = pick_eevdf(cfs_rq); 5756 + se = pick_eevdf(cfs_rq, protect); 5757 5757 if (se->sched_delayed) { 5758 5758 dequeue_entities(rq, se, DEQUEUE_SLEEP | DEQUEUE_DELAYED); 5759 5759 /* ··· 9027 9027 { 9028 9028 enum preempt_wakeup_action preempt_action = PREEMPT_WAKEUP_PICK; 9029 9029 struct task_struct *donor = rq->donor; 9030 - struct sched_entity *se = &donor->se, *pse = &p->se; 9030 + struct sched_entity *nse, *se = &donor->se, *pse = &p->se; 9031 9031 struct cfs_rq *cfs_rq = task_cfs_rq(donor); 9032 9032 int cse_is_idle, pse_is_idle; 9033 9033 ··· 9138 9138 } 9139 9139 9140 9140 pick: 9141 - /* 9142 - * If @p has become the most eligible task, force preemption. 9143 - */ 9144 - if (__pick_eevdf(cfs_rq, preempt_action != PREEMPT_WAKEUP_SHORT) == pse) 9141 + nse = pick_next_entity(rq, cfs_rq, preempt_action != PREEMPT_WAKEUP_SHORT); 9142 + /* If @p has become the most eligible task, force preemption */ 9143 + if (nse == pse) 9145 9144 goto preempt; 9145 + 9146 + /* 9147 + * Because p is enqueued, nse being null can only mean that we 9148 + * dequeued a delayed task. 9149 + */ 9150 + if (!nse) 9151 + goto pick; 9146 9152 9147 9153 if (sched_feat(RUN_TO_PARITY)) 9148 9154 update_protect_slice(cfs_rq, se); ··· 9185 9179 9186 9180 throttled |= check_cfs_rq_runtime(cfs_rq); 9187 9181 9188 - se = pick_next_entity(rq, cfs_rq); 9182 + se = pick_next_entity(rq, cfs_rq, true); 9189 9183 if (!se) 9190 9184 goto again; 9191 9185 cfs_rq = group_cfs_rq(se);