Re: [PATCH v26 05/10] sched: Fix modifying donor->blocked on without proper locking

From: Steven Rostedt

Date: Thu Mar 26 2026 - 17:46:09 EST



Nit, Subject needs s/donor->blocked on/donor->blocked_on/

On Tue, 24 Mar 2026 19:13:20 +0000
John Stultz <jstultz@xxxxxxxxxx> wrote:

> @@ -6595,6 +6595,7 @@ static struct task_struct *proxy_deactivate(struct rq *rq, struct task_struct *d
> static struct task_struct *
> find_proxy_task(struct rq *rq, struct task_struct *donor, struct rq_flags *rf)
> {
> + enum { FOUND, DEACTIVATE_DONOR } action = FOUND;
> struct task_struct *owner = NULL;
> int this_cpu = cpu_of(rq);
> struct task_struct *p;
> @@ -6628,12 +6629,14 @@ find_proxy_task(struct rq *rq, struct task_struct *donor, struct rq_flags *rf)
>
> if (!READ_ONCE(owner->on_rq) || owner->se.sched_delayed) {
> /* XXX Don't handle blocked owners/delayed dequeue yet */
> - return proxy_deactivate(rq, donor);
> + action = DEACTIVATE_DONOR;
> + break;
> }
>
> if (task_cpu(owner) != this_cpu) {
> /* XXX Don't handle migrations yet */
> - return proxy_deactivate(rq, donor);
> + action = DEACTIVATE_DONOR;
> + break;
> }
>
> if (task_on_rq_migrating(owner)) {
> @@ -6691,6 +6694,13 @@ find_proxy_task(struct rq *rq, struct task_struct *donor, struct rq_flags *rf)
> */
> }
>
> + /* Handle actions we need to do outside of the guard() scope */
> + switch (action) {
> + case DEACTIVATE_DONOR:
> + return proxy_deactivate(rq, donor);
> + case FOUND:
> + /* fallthrough */;

A fall through comment for exiting the switch statement is rather
confusing. Fallthrough usually means to fall into the next case statement.
You could just do:

switch (action) {
case DEACTIVATE_DONOR:
return proxy_deactivate(rq, donor);
case FOUND:
break;
}

Which is what I believe is the normal method of adding enums to switch
statements that don't do anything.

-- Steve



> + }
> WARN_ON_ONCE(owner && !owner->on_rq);
> return owner;
> }