Skip to content

Commit 018ee56

Browse files
Xiu Jianfenghtejun
authored andcommitted
cgroup/cpuset: Reduce the lock protecting CS_SCHED_LOAD_BALANCE
In the cpuset_css_online(), clearing the CS_SCHED_LOAD_BALANCE bit of cs->flags is guarded by callback_lock and cpuset_mutex. There is no problem with itself, because it is consistent with the description of there two global lock at the beginning of this file. However, since the operation of checking, setting and clearing the flag bit is atomic, protection of callback_lock is unnecessary here, see CS_SPREAD_*. so to make it more consistent with the other code, move the operation outside the critical section of callback_lock. No functional changes intended. Signed-off-by: Xiu Jianfeng <[email protected]> Acked-by: Waiman Long <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent a8d55ff commit 018ee56

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

kernel/cgroup/cpuset.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4038,6 +4038,12 @@ static int cpuset_css_online(struct cgroup_subsys_state *css)
40384038
set_bit(CS_SPREAD_PAGE, &cs->flags);
40394039
if (is_spread_slab(parent))
40404040
set_bit(CS_SPREAD_SLAB, &cs->flags);
4041+
/*
4042+
* For v2, clear CS_SCHED_LOAD_BALANCE if parent is isolated
4043+
*/
4044+
if (cgroup_subsys_on_dfl(cpuset_cgrp_subsys) &&
4045+
!is_sched_load_balance(parent))
4046+
clear_bit(CS_SCHED_LOAD_BALANCE, &cs->flags);
40414047

40424048
cpuset_inc();
40434049

@@ -4048,14 +4054,6 @@ static int cpuset_css_online(struct cgroup_subsys_state *css)
40484054
cs->use_parent_ecpus = true;
40494055
parent->child_ecpus_count++;
40504056
}
4051-
4052-
/*
4053-
* For v2, clear CS_SCHED_LOAD_BALANCE if parent is isolated
4054-
*/
4055-
if (cgroup_subsys_on_dfl(cpuset_cgrp_subsys) &&
4056-
!is_sched_load_balance(parent))
4057-
clear_bit(CS_SCHED_LOAD_BALANCE, &cs->flags);
4058-
40594057
spin_unlock_irq(&callback_lock);
40604058

40614059
if (!test_bit(CGRP_CPUSET_CLONE_CHILDREN, &css->cgroup->flags))

0 commit comments

Comments
 (0)