]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
sched: Fix migration_cpu_stop() WARN
authorPeter Zijlstra <peterz@infradead.org>
Tue, 17 Nov 2020 11:14:51 +0000 (12:14 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 19 Nov 2020 10:25:45 +0000 (11:25 +0100)
Oleksandr reported hitting the WARN in the 'task_rq(p) != rq' branch
of migration_cpu_stop(). Valentin noted that using cpu_of(rq) in that
case is just plain wrong to begin with, since per the earlier branch
that isn't the actual CPU of the task.

Replace both instances of is_cpu_allowed() by a direct p->cpus_mask
test using task_cpu().

Reported-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Debugged-by: Valentin Schneider <valentin.schneider@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
kernel/sched/core.c

index 4d1fd4b783ee454999cdb728a397c3ca4e14577e..28d541a3c74d53557868a9fdedc9406054bfda66 100644 (file)
@@ -1911,7 +1911,7 @@ static int migration_cpu_stop(void *data)
                         * and we should be valid again. Nothing to do.
                         */
                        if (!pending) {
-                               WARN_ON_ONCE(!is_cpu_allowed(p, cpu_of(rq)));
+                               WARN_ON_ONCE(!cpumask_test_cpu(task_cpu(p), &p->cpus_mask));
                                goto out;
                        }
 
@@ -1950,7 +1950,7 @@ static int migration_cpu_stop(void *data)
                 * valid again. Nothing to do.
                 */
                if (!pending) {
-                       WARN_ON_ONCE(!is_cpu_allowed(p, cpu_of(rq)));
+                       WARN_ON_ONCE(!cpumask_test_cpu(task_cpu(p), &p->cpus_mask));
                        goto out;
                }