Skip to content

Commit 6fcdb01

Browse files
Waiman-Longhtejun
authored andcommitted
cgroup/cpuset: Fix load balance state in update_partition_sd_lb()
Commit a86ce68 ("cgroup/cpuset: Extract out CS_CPU_EXCLUSIVE & CS_SCHED_LOAD_BALANCE handling") adds a new helper function update_partition_sd_lb() to update the load balance state of the cpuset. However the new load balance is determined by just looking at whether the cpuset is a valid isolated partition root or not. That is not enough if the cpuset is not a valid partition root but its parent is in the isolated state (load balance off). Update the function to set the new state to be the same as its parent in this case like what has been done in commit c8c9262 ("cgroup/cpuset: Inherit parent's load balance state in v2"). Fixes: a86ce68 ("cgroup/cpuset: Extract out CS_CPU_EXCLUSIVE & CS_SCHED_LOAD_BALANCE handling") Signed-off-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent d24f059 commit 6fcdb01

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

kernel/cgroup/cpuset.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1304,13 +1304,23 @@ static int update_partition_exclusive(struct cpuset *cs, int new_prs)
13041304
*
13051305
* Changing load balance flag will automatically call
13061306
* rebuild_sched_domains_locked().
1307+
* This function is for cgroup v2 only.
13071308
*/
13081309
static void update_partition_sd_lb(struct cpuset *cs, int old_prs)
13091310
{
13101311
int new_prs = cs->partition_root_state;
1311-
bool new_lb = (new_prs != PRS_ISOLATED);
13121312
bool rebuild_domains = (new_prs > 0) || (old_prs > 0);
1313+
bool new_lb;
13131314

1315+
/*
1316+
* If cs is not a valid partition root, the load balance state
1317+
* will follow its parent.
1318+
*/
1319+
if (new_prs > 0) {
1320+
new_lb = (new_prs != PRS_ISOLATED);
1321+
} else {
1322+
new_lb = is_sched_load_balance(parent_cs(cs));
1323+
}
13141324
if (new_lb != !!is_sched_load_balance(cs)) {
13151325
rebuild_domains = true;
13161326
if (new_lb)

0 commit comments

Comments
 (0)