Skip to content

Commit 39b5ef7

Browse files
Waiman-Longhtejun
authored andcommitted
cgroup/cpuset: Extend kthread_is_per_cpu() check to all PF_NO_SETAFFINITY tasks
Commit ec5fbdf ("cgroup/cpuset: Enable update_tasks_cpumask() on top_cpuset") enabled us to pull CPUs dedicated to child partitions from tasks in top_cpuset by ignoring per cpu kthreads. However, there can be other kthreads that are not per cpu but have PF_NO_SETAFFINITY flag set to indicate that we shouldn't mess with their CPU affinity. For other kthreads, their affinity will be changed to skip CPUs dedicated to child partitions whether it is an isolating or a scheduling one. As all the per cpu kthreads have PF_NO_SETAFFINITY set, the PF_NO_SETAFFINITY tasks are essentially a superset of per cpu kthreads. Fix this issue by dropping the kthread_is_per_cpu() check and checking the PF_NO_SETAFFINITY flag instead. Fixes: ec5fbdf ("cgroup/cpuset: Enable update_tasks_cpumask() on top_cpuset") Signed-off-by: Waiman Long <[email protected]> Acked-by: Frederic Weisbecker <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 1bf67c8 commit 39b5ef7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kernel/cgroup/cpuset.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,9 +1116,11 @@ void cpuset_update_tasks_cpumask(struct cpuset *cs, struct cpumask *new_cpus)
11161116

11171117
if (top_cs) {
11181118
/*
1119-
* Percpu kthreads in top_cpuset are ignored
1119+
* PF_NO_SETAFFINITY tasks are ignored.
1120+
* All per cpu kthreads should have PF_NO_SETAFFINITY
1121+
* flag set, see kthread_set_per_cpu().
11201122
*/
1121-
if (kthread_is_per_cpu(task))
1123+
if (task->flags & PF_NO_SETAFFINITY)
11221124
continue;
11231125
cpumask_andnot(new_cpus, possible_mask, subpartitions_cpus);
11241126
} else {

0 commit comments

Comments
 (0)