Skip to content

Commit 56e50ff

Browse files
author
Peter Zijlstra
committed
sched: Simplify ttwu_runnable()
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
1 parent c0404dd commit 56e50ff

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

kernel/sched/core.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3764,9 +3764,6 @@ static inline void proxy_reset_donor(struct rq *rq)
37643764
*/
37653765
static inline bool proxy_needs_return(struct rq *rq, struct task_struct *p)
37663766
{
3767-
if (!p->is_blocked)
3768-
return false;
3769-
37703767
/*
37713768
* Typically per __set_task_cpu(), task_cpu(p) == p->wake_cpu.
37723769
*
@@ -3875,10 +3872,12 @@ static int ttwu_runnable(struct task_struct *p, int wake_flags)
38753872
return 0;
38763873

38773874
update_rq_clock(rq);
3878-
if (p->se.sched_delayed)
3879-
enqueue_task(rq, p, ENQUEUE_NOCLOCK | ENQUEUE_DELAYED);
3880-
if (proxy_needs_return(rq, p))
3881-
return 0;
3875+
if (p->is_blocked) {
3876+
if (p->se.sched_delayed)
3877+
enqueue_task(rq, p, ENQUEUE_NOCLOCK | ENQUEUE_DELAYED);
3878+
if (proxy_needs_return(rq, p))
3879+
return 0;
3880+
}
38823881
if (!task_on_cpu(rq, p)) {
38833882
/*
38843883
* When on_rq && !on_cpu the task is preempted, see if

0 commit comments

Comments
 (0)