Commit af13e5e
Peter Zijlstra
sched: Fix the do_set_cpus_allowed() locking fix
Commit abfc010 ("sched: Fix do_set_cpus_allowed() locking")
overlooked that __balance_push_cpu_stop() calls select_fallback_rq()
with rq->lock held. This makes that set_cpus_allowed_force() will
recursively take rq->lock and the machine locks up.
Run select_fallback_rq() earlier, without holding rq->lock. This opens
up a race window where a task could get migrated out from under us, but
that is harmless, we want the task migrated.
select_fallback_rq() itself will not be subject to concurrency as it
will be fully serialized by p->pi_lock, so there is no chance of
set_cpus_allowed_force() getting called with different arguments and
selecting different fallback CPUs for one task.
Fixes: abfc010 ("sched: Fix do_set_cpus_allowed() locking")
Reported-by: Jan Polensky <japo@linux.ibm.com>
Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Jan Polensky <japo@linux.ibm.com>
Closes: https://lore.kernel.org/oe-lkp/202510271206.24495a68-lkp@intel.com
Link: https://patch.msgid.link/20251027110133.GI3245006@noisy.programming.kicks-ass.net1 parent 73cbcfe commit af13e5e
1 file changed
Lines changed: 7 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8044 | 8044 | | |
8045 | 8045 | | |
8046 | 8046 | | |
8047 | | - | |
8048 | | - | |
8049 | | - | |
8050 | | - | |
8051 | | - | |
8052 | | - | |
| 8047 | + | |
8053 | 8048 | | |
8054 | | - | |
8055 | | - | |
8056 | 8049 | | |
8057 | | - | |
8058 | | - | |
| 8050 | + | |
| 8051 | + | |
| 8052 | + | |
| 8053 | + | |
| 8054 | + | |
| 8055 | + | |
8059 | 8056 | | |
8060 | 8057 | | |
8061 | 8058 | | |
| |||
0 commit comments