aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r--kernel/cpuset.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 4334576f5d6a..644281003f5d 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -266,6 +266,7 @@ static struct workqueue_struct *cpuset_propagate_hotplug_wq;
266 266
267static void cpuset_hotplug_workfn(struct work_struct *work); 267static void cpuset_hotplug_workfn(struct work_struct *work);
268static void cpuset_propagate_hotplug_workfn(struct work_struct *work); 268static void cpuset_propagate_hotplug_workfn(struct work_struct *work);
269static void schedule_cpuset_propagate_hotplug(struct cpuset *cs);
269 270
270static DECLARE_WORK(cpuset_hotplug_work, cpuset_hotplug_workfn); 271static DECLARE_WORK(cpuset_hotplug_work, cpuset_hotplug_workfn);
271 272
@@ -1464,6 +1465,14 @@ static void cpuset_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)
1464 } 1465 }
1465 1466
1466 cs->attach_in_progress--; 1467 cs->attach_in_progress--;
1468
1469 /*
1470 * We may have raced with CPU/memory hotunplug. Trigger hotplug
1471 * propagation if @cs doesn't have any CPU or memory. It will move
1472 * the newly added tasks to the nearest parent which can execute.
1473 */
1474 if (cpumask_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))
1475 schedule_cpuset_propagate_hotplug(cs);
1467} 1476}
1468 1477
1469/* The various types of files and directories in a cpuset file system */ 1478/* The various types of files and directories in a cpuset file system */
@@ -1569,8 +1578,13 @@ static int cpuset_write_resmask(struct cgroup *cgrp, struct cftype *cft,
1569 * resources, wait for the previously scheduled operations before 1578 * resources, wait for the previously scheduled operations before
1570 * proceeding, so that we don't end up keep removing tasks added 1579 * proceeding, so that we don't end up keep removing tasks added
1571 * after execution capability is restored. 1580 * after execution capability is restored.
1581 *
1582 * Flushing cpuset_hotplug_work is enough to synchronize against
1583 * hotplug hanlding; however, cpuset_attach() may schedule
1584 * propagation work directly. Flush the workqueue too.
1572 */ 1585 */
1573 flush_work(&cpuset_hotplug_work); 1586 flush_work(&cpuset_hotplug_work);
1587 flush_workqueue(cpuset_propagate_hotplug_wq);
1574 1588
1575 if (!cgroup_lock_live_group(cgrp)) 1589 if (!cgroup_lock_live_group(cgrp))
1576 return -ENODEV; 1590 return -ENODEV;