Now, the task's user_cpus_ptr would dup from parent's user_cpus_ptr.
It is better reset the user_cpus_ptr when parent's reset_on_fork
is set.
Signed-off-by: Xuewen Yan <xuewen.yan@xxxxxxxxxx>
---
kernel/sched/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f3951e4a55e5..2fbae00cd1dc 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2666,7 +2666,7 @@ int dup_user_cpus_ptr(struct task_struct *dst, struct task_struct *src,
* do_set_cpus_allowed().
*/
raw_spin_lock_irqsave(&src->pi_lock, flags);
- if (src->user_cpus_ptr) {
+ if (src->user_cpus_ptr && !src->sched_reset_on_fork) {
swap(dst->user_cpus_ptr, user_mask);
cpumask_copy(dst->user_cpus_ptr, src->user_cpus_ptr);
}