diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index b474289c15b8..9c17b6d4877c 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -1942,6 +1942,7 @@ static void update_tasks_nodemask(struct cpuset *cs) static nodemask_t newmems; /* protected by cpuset_rwsem */ struct css_task_iter it; struct task_struct *task; + bool migrate; cpuset_being_rebound = cs; /* causes mpol_dup() rebind */ @@ -1957,19 +1958,25 @@ static void update_tasks_nodemask(struct cpuset *cs) * It's ok if we rebind the same mm twice; mpol_rebind_mm() * is idempotent. Also migrate pages in each mm to new nodes. */ + migrate = is_memory_migrate(cs); css_task_iter_start(&cs->css, 0, &it); while ((task = css_task_iter_next(&it))) { struct mm_struct *mm; - bool migrate; cpuset_change_task_nodemask(task, &newmems); + /* + * Skip mm update if a non group leader task and its group + * leader are in the same cpuset. + */ + if (!thread_group_leader(task) && + (task_cs(task->group_leader) == cs)) + continue; + mm = get_task_mm(task); if (!mm) continue; - migrate = is_memory_migrate(cs); - mpol_rebind_mm(mm, &cs->mems_allowed); if (migrate) cpuset_migrate_mm(mm, &cs->old_mems_allowed, &newmems);