projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
86fbcd3
)
sched: Deny self-issued __set_cpus_allowed_ptr() when migrate_disable()
author
Valentin Schneider
<valentin.schneider@arm.com>
Tue, 13 Oct 2020 14:01:15 +0000
(15:01 +0100)
committer
Peter Zijlstra
<peterz@infradead.org>
Tue, 10 Nov 2020 17:39:02 +0000
(18:39 +0100)
migrate_disable();
set_cpus_allowed_ptr(current, {something excluding task_cpu(current)});
affine_move_task(); <-- never returns
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link:
https://lkml.kernel.org/r/20201013140116.26651-1-valentin.schneider@arm.com
kernel/sched/core.c
patch
|
blob
|
history
diff --git
a/kernel/sched/core.c
b/kernel/sched/core.c
index e92d7853057c23d683d4c6779ffaf4e9438761a5..88c6fcb3bb6543912bcb1ec70fd9ba2e4f1aa0a9 100644
(file)
--- a/
kernel/sched/core.c
+++ b/
kernel/sched/core.c
@@
-2238,8
+2238,17
@@
static int __set_cpus_allowed_ptr(struct task_struct *p,
goto out;
}
- if (!(flags & SCA_MIGRATE_ENABLE) && cpumask_equal(&p->cpus_mask, new_mask))
- goto out;
+ if (!(flags & SCA_MIGRATE_ENABLE)) {
+ if (cpumask_equal(&p->cpus_mask, new_mask))
+ goto out;
+
+ if (WARN_ON_ONCE(p == current &&
+ is_migration_disabled(p) &&
+ !cpumask_test_cpu(task_cpu(p), new_mask))) {
+ ret = -EBUSY;
+ goto out;
+ }
+ }
/*
* Picking a ~random cpu helps in cases where we are changing affinity