mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Check whether the wakeup task is eligible first
@ 2024-03-01 12:45 bala
  0 siblings, 0 replies; only message in thread
From: bala @ 2024-03-01 12:45 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo, peterz, Bala

From: Bala <kumaran.4353@gmail.com>

check_prempt_wakeup_fair is checking whether the current task has to be
preempted by the newly wake-up task. To avoid multiple swaps the logic
is decided as if the wake-up task is the best task then only preempt the
current task.

In CFS time, getting the best task was as simple as piking the left-most
node. But in EEVDF non-fast path, the entire tree has to be traversed in
a worst case scenario.

So, IMHO let's first check the newly wake-up task is eligible before
searching for the best task. At least until the comment becomes
effective to preempt the curr irrespective of the waking task.
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 533547e3c90a..8d810d6a2cb7 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8334,7 +8334,7 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int
 	/*
 	 * XXX pick_eevdf(cfs_rq) != se ?
 	 */
-	if (pick_eevdf(cfs_rq) == pse)
+	if (entity_eligible(cfs_rq, pse) && (pick_eevdf(cfs_rq) == pse))
 		goto preempt;
 
 	return;
-- 
2.33.8


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-01 12:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-01 12:45 [PATCH] Check whether the wakeup task is eligible first bala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®