cgroup, memcg, cpuset: implement cgroup_taskset_for_each_leader()
[firefly-linux-kernel-4.4.55.git] / kernel / cpuset.c
index 0b361a0b58f69fe8d6aaa2ede0d2b402cf8809a5..e4d999929903b72ff75fba0e20297fb1a6d617db 100644 (file)
@@ -1488,7 +1488,7 @@ static void cpuset_attach(struct cgroup_subsys_state *css,
        /* static buf protected by cpuset_mutex */
        static nodemask_t cpuset_attach_nodemask_to;
        struct task_struct *task;
-       struct task_struct *leader = cgroup_taskset_first(tset);
+       struct task_struct *leader;
        struct cpuset *cs = css_cs(css);
        struct cpuset *oldcs = cpuset_attach_old_cs;
 
@@ -1514,12 +1514,11 @@ static void cpuset_attach(struct cgroup_subsys_state *css,
        }
 
        /*
-        * Change mm, possibly for multiple threads in a threadgroup. This
-        * is expensive and may sleep and should be moved outside migration
-        * path proper.
+        * Change mm for all threadgroup leaders. This is expensive and may
+        * sleep and should be moved outside migration path proper.
         */
        cpuset_attach_nodemask_to = cs->effective_mems;
-       if (thread_group_leader(leader)) {
+       cgroup_taskset_for_each_leader(leader, tset) {
                struct mm_struct *mm = get_task_mm(leader);
 
                if (mm) {