mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kuba Piecuch <jpiecuch@google.com>
To: peterz@infradead.org, mingo@redhat.com,
	vincent.guittot@linaro.org,  dietmar.eggemann@arm.com,
	joshdon@google.com
Cc: linux-kernel@vger.kernel.org, Kuba Piecuch <jpiecuch@google.com>
Subject: [RFC PATCH 2/3] sched/fair: don't schedule() in yield if nr_running == 1
Date: Fri,  8 Aug 2025 20:02:49 +0000	[thread overview]
Message-ID: <20250808200250.2016584-3-jpiecuch@google.com> (raw)
In-Reply-To: <20250808200250.2016584-1-jpiecuch@google.com>

There's no need to schedule() if we know that there are no other tasks
to pick.

Signed-off-by: Kuba Piecuch <jpiecuch@google.com>
---
 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 c06a2f8290822..3f9bfc64e0bc5 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9020,7 +9020,7 @@ static bool yield_task_fair(struct rq *rq)
 	 * Are we the only task in the tree?
 	 */
 	if (unlikely(rq->nr_running == 1))
-		return true;
+		return false;
 
 	clear_buddies(cfs_rq, se);
 
-- 
2.51.0.rc0.155.g4a0f42376b-goog


  parent reply	other threads:[~2025-08-08 20:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-08 20:02 [RFC PATCH 0/3] sched: add ability to throttle sched_yield() calls to reduce contention Kuba Piecuch
2025-08-08 20:02 ` [RFC PATCH 1/3] sched: add bool return value to sched_class::yield_task() Kuba Piecuch
2025-08-08 20:02 ` Kuba Piecuch [this message]
2025-08-08 20:02 ` [RFC PATCH 3/3] sched/fair: add debugfs knob for yield throttling Kuba Piecuch
2025-08-11  8:36 ` [RFC PATCH 0/3] sched: add ability to throttle sched_yield() calls to reduce contention Peter Zijlstra
2025-08-11 13:35   ` Kuba Piecuch
2025-08-14 14:53     ` Peter Zijlstra
2025-08-17 14:29       ` David Laight
2025-08-19 14:08       ` Kuba Piecuch
2025-08-20 15:49         ` Kuba Piecuch

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=20250808200250.2016584-3-jpiecuch@google.com \
    --to=jpiecuch@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=joshdon@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.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®