From: Peter Zijlstra <peterz@infradead.org>
To: John Stultz <jstultz@google.com>,
K Prateek Nayak <kprateek.nayak@amd.com>
Cc: Joel Fernandes <joelagnelf@nvidia.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: Qais Yousef <qyousef@layalina.io>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Valentin Schneider <vschneid@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ben Segall <bsegall@google.com>
Cc: Zimuzo Ezeozue <zezeozue@google.com>
Cc: Will Deacon <will@kernel.org>
Cc: Waiman Long <longman@redhat.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Metin Kaya <Metin.Kaya@arm.com>
Cc: Xuewen Yan <xuewen.yan94@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Suleiman Souhlal <suleiman@google.com>
Cc: kuyo chang <kuyo.chang@mediatek.com>
Cc: hupu <hupu.gm@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: Mike Galbraith <efault@gmx.de>
Subject: [PATCH 6/6] sched: Simplify ttwu_runnable()
Date: Tue, 26 May 2026 13:16:15 +0200 [thread overview]
Message-ID: <20260526113322.714832584@infradead.org> (raw)
In-Reply-To: <20260526111609.433880331@infradead.org>
Note that both proxy and delayed tasks have ->is_blocked set. Use this one
condition to guard both paths.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
kernel/sched/core.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3764,9 +3764,6 @@ static inline void proxy_reset_donor(str
*/
static inline bool proxy_needs_return(struct rq *rq, struct task_struct *p)
{
- if (!p->is_blocked)
- return false;
-
scoped_guard(raw_spinlock, &p->blocked_lock) {
/* Task is waking up; clear any blocked_on relationship */
__clear_task_blocked_on(p, NULL);
@@ -3860,10 +3857,12 @@ static int ttwu_runnable(struct task_str
return 0;
update_rq_clock(rq);
- if (p->se.sched_delayed)
- enqueue_task(rq, p, ENQUEUE_NOCLOCK | ENQUEUE_DELAYED);
- if (proxy_needs_return(rq, p))
- return 0;
+ if (p->is_blocked) {
+ if (p->se.sched_delayed)
+ enqueue_task(rq, p, ENQUEUE_NOCLOCK | ENQUEUE_DELAYED);
+ if (proxy_needs_return(rq, p))
+ return 0;
+ }
if (!task_on_cpu(rq, p)) {
/*
* When on_rq && !on_cpu the task is preempted, see if
next prev parent reply other threads:[~2026-05-26 11:37 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 11:16 [PATCH 0/6] sched/proxy: doodles Peter Zijlstra
2026-05-26 11:16 ` [PATCH 1/6] sched/proxy: Remove superfluous clear_task_blocked_in() Peter Zijlstra
2026-05-26 23:39 ` John Stultz
2026-05-26 23:54 ` John Stultz
2026-05-27 8:59 ` Peter Zijlstra
2026-05-28 23:20 ` John Stultz
2026-05-29 6:45 ` K Prateek Nayak
2026-05-29 7:14 ` John Stultz
2026-05-29 8:24 ` K Prateek Nayak
2026-05-29 8:47 ` Peter Zijlstra
2026-05-29 8:50 ` Peter Zijlstra
2026-05-29 10:46 ` K Prateek Nayak
2026-05-30 2:56 ` John Stultz
2026-05-29 9:33 ` Peter Zijlstra
2026-05-29 6:48 ` John Stultz
2026-05-29 7:58 ` K Prateek Nayak
2026-05-29 10:06 ` Peter Zijlstra
2026-05-29 10:54 ` K Prateek Nayak
2026-06-04 18:45 ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2026-05-26 11:16 ` [PATCH 2/6] sched/proxy: Optimize try_to_wake_up() Peter Zijlstra
2026-05-27 1:56 ` John Stultz
2026-06-04 18:45 ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2026-05-26 11:16 ` [PATCH 3/6] sched: Be more strict about p->is_blocked Peter Zijlstra
2026-05-27 1:56 ` John Stultz
2026-06-04 18:45 ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2026-05-26 11:16 ` [PATCH 4/6] sched/proxy: Switch proxy to use p->is_blocked Peter Zijlstra
2026-05-26 14:57 ` Peter Zijlstra
2026-05-26 19:48 ` John Stultz
2026-05-27 2:25 ` John Stultz
2026-05-27 8:29 ` Peter Zijlstra
2026-06-04 18:45 ` [tip: sched/core] sched/proxy: Only return migrate when needed tip-bot2 for Peter Zijlstra
2026-06-04 18:45 ` [tip: sched/core] sched/proxy: Switch proxy to use p->is_blocked tip-bot2 for Peter Zijlstra
2026-05-26 11:16 ` [PATCH 5/6] sched/proxy: Remove PROXY_WAKING Peter Zijlstra
2026-06-01 10:54 ` Peter Zijlstra
2026-06-01 20:32 ` John Stultz
2026-06-02 5:22 ` K Prateek Nayak
2026-06-02 6:58 ` John Stultz
2026-06-02 10:02 ` Peter Zijlstra
2026-06-04 18:29 ` John Stultz
2026-06-04 18:41 ` Peter Zijlstra
2026-06-02 3:19 ` K Prateek Nayak
2026-06-04 18:45 ` [tip: sched/core] " tip-bot2 for K Prateek Nayak
2026-05-26 11:16 ` Peter Zijlstra [this message]
2026-06-04 18:45 ` [tip: sched/core] sched: Simplify ttwu_runnable() tip-bot2 for Peter Zijlstra
2026-05-26 11:45 ` [PATCH 0/6] sched/proxy: doodles Peter Zijlstra
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=20260526113322.714832584@infradead.org \
--to=peterz@infradead.org \
--cc=joelagnelf@nvidia.com \
--cc=jstultz@google.com \
--cc=kprateek.nayak@amd.com \
/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
Powered by JetHome