]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sched: Simplify ttwu_runnable()
authorPeter Zijlstra <peterz@infradead.org>
Tue, 26 May 2026 10:00:59 +0000 (12:00 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 2 Jun 2026 10:26:10 +0000 (12:26 +0200)
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>
Link: https://patch.msgid.link/20260526113322.714832584%40infradead.org
kernel/sched/core.c

index d5795188d5b6191029b8ceec8a11948d4110cc42..5a317f62a516fd3307b17a49b8b3104034d1f017 100644 (file)
@@ -3764,9 +3764,6 @@ static inline void proxy_reset_donor(struct rq *rq)
  */
 static inline bool proxy_needs_return(struct rq *rq, struct task_struct *p)
 {
-       if (!p->is_blocked)
-               return false;
-
        /*
         * Typically per __set_task_cpu(), task_cpu(p) == p->wake_cpu.
         *
@@ -3875,10 +3872,12 @@ static int ttwu_runnable(struct task_struct *p, int wake_flags)
                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