@@ -2207,12 +2207,6 @@ static void compute_partition_effective_cpumask(struct cpuset *cs,
22072207 rcu_read_unlock ();
22082208}
22092209
2210- /*
2211- * update_cpumasks_hier() flags
2212- */
2213- #define HIER_CHECKALL 0x01 /* Check all cpusets with no skipping */
2214- #define HIER_NO_SD_REBUILD 0x02 /* Don't rebuild sched domains */
2215-
22162210/*
22172211 * update_cpumasks_hier - Update effective cpumasks and tasks in the subtree
22182212 * @cs: the cpuset to consider
@@ -2227,7 +2221,7 @@ static void compute_partition_effective_cpumask(struct cpuset *cs,
22272221 * Called with cpuset_mutex held
22282222 */
22292223static void update_cpumasks_hier (struct cpuset * cs , struct tmpmasks * tmp ,
2230- int flags )
2224+ bool force )
22312225{
22322226 struct cpuset * cp ;
22332227 struct cgroup_subsys_state * pos_css ;
@@ -2292,10 +2286,10 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp,
22922286 * Skip the whole subtree if
22932287 * 1) the cpumask remains the same,
22942288 * 2) has no partition root state,
2295- * 3) HIER_CHECKALL flag not set, and
2289+ * 3) force flag not set, and
22962290 * 4) for v2 load balance state same as its parent.
22972291 */
2298- if (!cp -> partition_root_state && !( flags & HIER_CHECKALL ) &&
2292+ if (!cp -> partition_root_state && !force &&
22992293 cpumask_equal (tmp -> new_cpus , cp -> effective_cpus ) &&
23002294 (!cgroup_subsys_on_dfl (cpuset_cgrp_subsys ) ||
23012295 (is_sched_load_balance (parent ) == is_sched_load_balance (cp )))) {
@@ -2397,8 +2391,7 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp,
23972391 }
23982392 rcu_read_unlock ();
23992393
2400- if (need_rebuild_sched_domains && !(flags & HIER_NO_SD_REBUILD ) &&
2401- !force_sd_rebuild )
2394+ if (need_rebuild_sched_domains && !force_sd_rebuild )
24022395 rebuild_sched_domains_locked ();
24032396}
24042397
@@ -2426,9 +2419,7 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs,
24262419 * directly.
24272420 *
24282421 * The update_cpumasks_hier() function may sleep. So we have to
2429- * release the RCU read lock before calling it. HIER_NO_SD_REBUILD
2430- * flag is used to suppress rebuild of sched domains as the callers
2431- * will take care of that.
2422+ * release the RCU read lock before calling it.
24322423 */
24332424 rcu_read_lock ();
24342425 cpuset_for_each_child (sibling , pos_css , parent ) {
@@ -2444,7 +2435,7 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs,
24442435 continue ;
24452436
24462437 rcu_read_unlock ();
2447- update_cpumasks_hier (sibling , tmp , HIER_NO_SD_REBUILD );
2438+ update_cpumasks_hier (sibling , tmp , false );
24482439 rcu_read_lock ();
24492440 css_put (& sibling -> css );
24502441 }
@@ -2464,7 +2455,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
24642455 struct tmpmasks tmp ;
24652456 struct cpuset * parent = parent_cs (cs );
24662457 bool invalidate = false;
2467- int hier_flags = 0 ;
2458+ bool force = false ;
24682459 int old_prs = cs -> partition_root_state ;
24692460
24702461 /* top_cpuset.cpus_allowed tracks cpu_online_mask; it's read-only */
@@ -2525,8 +2516,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
25252516 * Check all the descendants in update_cpumasks_hier() if
25262517 * effective_xcpus is to be changed.
25272518 */
2528- if (!cpumask_equal (cs -> effective_xcpus , trialcs -> effective_xcpus ))
2529- hier_flags = HIER_CHECKALL ;
2519+ force = !cpumask_equal (cs -> effective_xcpus , trialcs -> effective_xcpus );
25302520
25312521 retval = validate_change (cs , trialcs );
25322522
@@ -2594,7 +2584,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
25942584 spin_unlock_irq (& callback_lock );
25952585
25962586 /* effective_cpus/effective_xcpus will be updated here */
2597- update_cpumasks_hier (cs , & tmp , hier_flags );
2587+ update_cpumasks_hier (cs , & tmp , force );
25982588
25992589 /* Update CS_SCHED_LOAD_BALANCE and/or sched_domains, if necessary */
26002590 if (cs -> partition_root_state )
@@ -2619,7 +2609,7 @@ static int update_exclusive_cpumask(struct cpuset *cs, struct cpuset *trialcs,
26192609 struct tmpmasks tmp ;
26202610 struct cpuset * parent = parent_cs (cs );
26212611 bool invalidate = false;
2622- int hier_flags = 0 ;
2612+ bool force = false ;
26232613 int old_prs = cs -> partition_root_state ;
26242614
26252615 if (!* buf ) {
@@ -2642,8 +2632,7 @@ static int update_exclusive_cpumask(struct cpuset *cs, struct cpuset *trialcs,
26422632 * Check all the descendants in update_cpumasks_hier() if
26432633 * effective_xcpus is to be changed.
26442634 */
2645- if (!cpumask_equal (cs -> effective_xcpus , trialcs -> effective_xcpus ))
2646- hier_flags = HIER_CHECKALL ;
2635+ force = !cpumask_equal (cs -> effective_xcpus , trialcs -> effective_xcpus );
26472636
26482637 retval = validate_change (cs , trialcs );
26492638 if (retval )
@@ -2696,8 +2685,8 @@ static int update_exclusive_cpumask(struct cpuset *cs, struct cpuset *trialcs,
26962685 * of the subtree when it is a valid partition root or effective_xcpus
26972686 * is updated.
26982687 */
2699- if (is_partition_valid (cs ) || hier_flags )
2700- update_cpumasks_hier (cs , & tmp , hier_flags );
2688+ if (is_partition_valid (cs ) || force )
2689+ update_cpumasks_hier (cs , & tmp , force );
27012690
27022691 /* Update CS_SCHED_LOAD_BALANCE and/or sched_domains, if necessary */
27032692 if (cs -> partition_root_state )
@@ -3174,7 +3163,7 @@ static int update_prstate(struct cpuset *cs, int new_prs)
31743163 update_unbound_workqueue_cpumask (new_xcpus_state );
31753164
31763165 /* Force update if switching back to member */
3177- update_cpumasks_hier (cs , & tmpmask , !new_prs ? HIER_CHECKALL : 0 );
3166+ update_cpumasks_hier (cs , & tmpmask , !new_prs );
31783167
31793168 /* Update sched domains and load balance flag */
31803169 update_partition_sd_lb (cs , old_prs );
0 commit comments