mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Balakumaran Kannan <kumaran.4353@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@redhat.com, peterz@infradead.org,
	Balakumaran Kannan <kumaran.4353@gmail.com>
Subject: [PATCH v2] Check whether the wakeup task is eligible first
Date: Fri,  1 Mar 2024 13:01:00 +0000	[thread overview]
Message-ID: <20240301130100.267727-1-kumaran.4353@gmail.com> (raw)

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.

Signed-off-by: Balakumaran Kannan <kumaran.4353@gmail.com>
---
Changes in v2:
  - Fixed the commit message with proper name and Signed-off-by

 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


                 reply	other threads:[~2024-03-01 13:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240301130100.267727-1-kumaran.4353@gmail.com \
    --to=kumaran.4353@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®