Skip to content

Commit fbfbf86

Browse files
Waiman-Longhtejun
authored andcommitted
cgroup/cpuset: Disable cpuset_cpumask_can_shrink() test if not load balancing
With some recent proposed changes [1] in the deadline server code, it has caused a test failure in test_cpuset_prs.sh when a change is being made to an isolated partition. This is due to failing the cpuset_cpumask_can_shrink() check for SCHED_DEADLINE tasks at validate_change(). This is actually a false positive as the failed test case involves an isolated partition with load balancing disabled. The deadline check is not meaningful in this case and the users should know what they are doing. Fix this by doing the cpuset_cpumask_can_shrink() check only when loading balanced is enabled. Also change its arguments to use effective_cpus for the current cpuset and user_xcpus() as an approiximation for the target effective_cpus as the real effective_cpus hasn't been fully computed yet as this early stage. As the check isn't comprehensive, there may be false positives or negatives. We may have to revise the code to do a more thorough check in the future if this becomes a concern. [1] https://lore.kernel.org/lkml/[email protected]/T/#t Signed-off-by: Waiman Long <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent c4c9ceb commit fbfbf86

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

kernel/cgroup/cpuset.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,12 +581,24 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial)
581581

582582
/*
583583
* We can't shrink if we won't have enough room for SCHED_DEADLINE
584-
* tasks.
584+
* tasks. This check is not done when scheduling is disabled as the
585+
* users should know what they are doing.
586+
*
587+
* For v1, effective_cpus == cpus_allowed & user_xcpus() returns
588+
* cpus_allowed.
589+
*
590+
* For v2, is_cpu_exclusive() & is_sched_load_balance() are true only
591+
* for non-isolated partition root. At this point, the target
592+
* effective_cpus isn't computed yet. user_xcpus() is the best
593+
* approximation.
594+
*
595+
* TBD: May need to precompute the real effective_cpus here in case
596+
* incorrect scheduling of SCHED_DEADLINE tasks in a partition
597+
* becomes an issue.
585598
*/
586599
ret = -EBUSY;
587-
if (is_cpu_exclusive(cur) &&
588-
!cpuset_cpumask_can_shrink(cur->cpus_allowed,
589-
trial->cpus_allowed))
600+
if (is_cpu_exclusive(cur) && is_sched_load_balance(cur) &&
601+
!cpuset_cpumask_can_shrink(cur->effective_cpus, user_xcpus(trial)))
590602
goto out;
591603

592604
/*

0 commit comments

Comments
 (0)