Skip to contentSkip to conversation

sched: save to call pick_eevdf when TIF_NEED_RESCHED is set

PATCH New Ze Gao 1 participant 1 message Jan 5, 2024 Scheduler

lore
Share & tools
lore

Ze Gao

author
#0 lore raw

PATCH 1/1 sched: save to call pick_eevdf when TIF_NEED_RESCHED is set

We now can have TIF_NEED_RESCHED set from update_curr() in check_preempt_wakeup_fair(), so check to save to call pick_eevdf once it's set and defer the possible picking to where schedule() is called.

---
 kernel/sched/fair.c | 6 ++++++
 1 file changed, 6 insertions(+)
kernel/sched/fair.c +6 -0
index d7a3c63a2171..28b2860e1f09 100644
@@ -8273,6 +8273,12 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int
 	cfs_rq = cfs_rq_of(se);
 	update_curr(cfs_rq);
 
+	/*
+	 * We can come here with TIF_NEED_RESCHED already set from update_curr,
+	 * check to save one call to pick_eevdf if it's set.
+	 */
+	if (test_tsk_need_resched(curr))
+		return;
 	/*
 	 * XXX pick_eevdf(cfs_rq) != se ?
 	 */
Signature · 1 line
2.41.0