Skip to content

Commit 18f9a4d

Browse files
Waiman-Longhtejun
authored andcommitted
cgroup/cpuset: Skip spread flags update on v2
Cpuset v2 has no spread flags to set. So we can skip spread flags update if cpuset v2 is being used. Also change the name to cpuset_update_task_spread_flags() to indicate that there are multiple spread flags. Signed-off-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 35b7fa4 commit 18f9a4d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

kernel/cgroup/cpuset.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -550,11 +550,15 @@ static void guarantee_online_mems(struct cpuset *cs, nodemask_t *pmask)
550550
/*
551551
* update task's spread flag if cpuset's page/slab spread flag is set
552552
*
553-
* Call with callback_lock or cpuset_rwsem held.
553+
* Call with callback_lock or cpuset_rwsem held. The check can be skipped
554+
* if on default hierarchy.
554555
*/
555-
static void cpuset_update_task_spread_flag(struct cpuset *cs,
556+
static void cpuset_update_task_spread_flags(struct cpuset *cs,
556557
struct task_struct *tsk)
557558
{
559+
if (cgroup_subsys_on_dfl(cpuset_cgrp_subsys))
560+
return;
561+
558562
if (is_spread_page(cs))
559563
task_set_spread_page(tsk);
560564
else
@@ -2153,7 +2157,7 @@ static void update_tasks_flags(struct cpuset *cs)
21532157

21542158
css_task_iter_start(&cs->css, 0, &it);
21552159
while ((task = css_task_iter_next(&it)))
2156-
cpuset_update_task_spread_flag(cs, task);
2160+
cpuset_update_task_spread_flags(cs, task);
21572161
css_task_iter_end(&it);
21582162
}
21592163

@@ -2530,7 +2534,7 @@ static void cpuset_attach(struct cgroup_taskset *tset)
25302534
WARN_ON_ONCE(set_cpus_allowed_ptr(task, cpus_attach));
25312535

25322536
cpuset_change_task_nodemask(task, &cpuset_attach_nodemask_to);
2533-
cpuset_update_task_spread_flag(cs, task);
2537+
cpuset_update_task_spread_flags(cs, task);
25342538
}
25352539

25362540
/*

0 commit comments

Comments
 (0)