Commit ec5fbdfb authored by Waiman Long's avatar Waiman Long Committed by Tejun Heo

cgroup/cpuset: Enable update_tasks_cpumask() on top_cpuset

Previously, update_tasks_cpumask() is not supposed to be called with
top cpuset. With cpuset partition that takes CPUs away from the top
cpuset, adjusting the cpus_mask of the tasks in the top cpuset is
necessary. Percpu kthreads, however, are ignored.

Fixes: ee8dde0c ("cpuset: Add new v2 cpuset.sched.partition flag")
Signed-off-by: default avatarWaiman Long <longman@redhat.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 5251c6c4
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/kmod.h> #include <linux/kmod.h>
#include <linux/kthread.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/mempolicy.h> #include <linux/mempolicy.h>
#include <linux/mm.h> #include <linux/mm.h>
...@@ -1127,10 +1128,18 @@ static void update_tasks_cpumask(struct cpuset *cs) ...@@ -1127,10 +1128,18 @@ static void update_tasks_cpumask(struct cpuset *cs)
{ {
struct css_task_iter it; struct css_task_iter it;
struct task_struct *task; struct task_struct *task;
bool top_cs = cs == &top_cpuset;
css_task_iter_start(&cs->css, 0, &it); css_task_iter_start(&cs->css, 0, &it);
while ((task = css_task_iter_next(&it))) while ((task = css_task_iter_next(&it))) {
/*
* Percpu kthreads in top_cpuset are ignored
*/
if (top_cs && (task->flags & PF_KTHREAD) &&
kthread_is_per_cpu(task))
continue;
set_cpus_allowed_ptr(task, cs->effective_cpus); set_cpus_allowed_ptr(task, cs->effective_cpus);
}
css_task_iter_end(&it); css_task_iter_end(&it);
} }
...@@ -2092,12 +2101,7 @@ static int update_prstate(struct cpuset *cs, int new_prs) ...@@ -2092,12 +2101,7 @@ static int update_prstate(struct cpuset *cs, int new_prs)
update_flag(CS_CPU_EXCLUSIVE, cs, 0); update_flag(CS_CPU_EXCLUSIVE, cs, 0);
} }
/* update_tasks_cpumask(parent);
* Update cpumask of parent's tasks except when it is the top
* cpuset as some system daemons cannot be mapped to other CPUs.
*/
if (parent != &top_cpuset)
update_tasks_cpumask(parent);
if (parent->child_ecpus_count) if (parent->child_ecpus_count)
update_sibling_cpumasks(parent, cs, &tmpmask); update_sibling_cpumasks(parent, cs, &tmpmask);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment