@@ -358,8 +358,13 @@ static inline bool is_in_v2_mode(void)
358358 * @excluded_child: a child cpuset to be excluded in task checking
359359 * Return: true if there are tasks, false otherwise
360360 *
361- * It is assumed that @cs is a valid partition root. @excluded_child should
362- * be non-NULL when this cpuset is going to become a partition itself.
361+ * @cs should be a valid partition root or going to become a partition root.
362+ * @excluded_child should be non-NULL when this cpuset is going to become a
363+ * partition itself.
364+ *
365+ * Note that a remote partition is not allowed underneath a valid local
366+ * or remote partition. So if a non-partition root child is populated,
367+ * the whole partition is considered populated.
363368 */
364369static inline bool partition_is_populated (struct cpuset * cs ,
365370 struct cpuset * excluded_child )
@@ -369,8 +374,6 @@ static inline bool partition_is_populated(struct cpuset *cs,
369374
370375 if (cs -> css .cgroup -> nr_populated_csets )
371376 return true;
372- if (!excluded_child && !cs -> nr_subparts )
373- return cgroup_is_populated (cs -> css .cgroup );
374377
375378 rcu_read_lock ();
376379 cpuset_for_each_child (child , css , cs ) {
@@ -1302,7 +1305,6 @@ static void reset_partition_data(struct cpuset *cs)
13021305
13031306 lockdep_assert_held (& callback_lock );
13041307
1305- cs -> nr_subparts = 0 ;
13061308 if (cpumask_empty (cs -> exclusive_cpus )) {
13071309 cpumask_clear (cs -> effective_xcpus );
13081310 if (is_cpu_exclusive (cs ))
@@ -1746,7 +1748,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
17461748 int deleting ; /* Deleting cpus from parent's effective_cpus */
17471749 int old_prs , new_prs ;
17481750 int part_error = PERR_NONE ; /* Partition error? */
1749- int subparts_delta = 0 ;
17501751 int isolcpus_updated = 0 ;
17511752 struct cpumask * xcpus = user_xcpus (cs );
17521753 bool nocpu ;
@@ -1771,10 +1772,9 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
17711772 if (is_partition_valid (parent ))
17721773 adding = cpumask_and (tmp -> addmask ,
17731774 xcpus , parent -> effective_xcpus );
1774- if (old_prs > 0 ) {
1775+ if (old_prs > 0 )
17751776 new_prs = - old_prs ;
1776- subparts_delta -- ;
1777- }
1777+
17781778 goto write_error ;
17791779 }
17801780
@@ -1829,7 +1829,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
18291829 WARN_ON_ONCE (!cpumask_subset (tmp -> new_cpus , parent -> effective_cpus ));
18301830
18311831 deleting = true;
1832- subparts_delta ++ ;
18331832 } else if (cmd == partcmd_disable ) {
18341833 /*
18351834 * May need to add cpus back to parent's effective_cpus
@@ -1840,7 +1839,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
18401839 if (is_partition_valid (cs )) {
18411840 cpumask_copy (tmp -> addmask , cs -> effective_xcpus );
18421841 adding = true;
1843- subparts_delta -- ;
18441842 }
18451843 new_prs = PRS_MEMBER ;
18461844 } else if (newmask ) {
@@ -1963,17 +1961,13 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
19631961 switch (cs -> partition_root_state ) {
19641962 case PRS_ROOT :
19651963 case PRS_ISOLATED :
1966- if (part_error ) {
1964+ if (part_error )
19671965 new_prs = - old_prs ;
1968- subparts_delta -- ;
1969- }
19701966 break ;
19711967 case PRS_INVALID_ROOT :
19721968 case PRS_INVALID_ISOLATED :
1973- if (!part_error ) {
1969+ if (!part_error )
19741970 new_prs = - old_prs ;
1975- subparts_delta ++ ;
1976- }
19771971 break ;
19781972 }
19791973 }
@@ -2002,11 +1996,9 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
20021996 * newly deleted ones will be added back to effective_cpus.
20031997 */
20041998 spin_lock_irq (& callback_lock );
2005- if (old_prs != new_prs ) {
1999+ if (old_prs != new_prs )
20062000 cs -> partition_root_state = new_prs ;
2007- if (new_prs <= 0 )
2008- cs -> nr_subparts = 0 ;
2009- }
2001+
20102002 /*
20112003 * Adding to parent's effective_cpus means deletion CPUs from cs
20122004 * and vice versa.
@@ -2018,10 +2010,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
20182010 isolcpus_updated += partition_xcpus_add (new_prs , parent ,
20192011 tmp -> delmask );
20202012
2021- if (is_partition_valid (parent )) {
2022- parent -> nr_subparts += subparts_delta ;
2023- WARN_ON_ONCE (parent -> nr_subparts < 0 );
2024- }
20252013 spin_unlock_irq (& callback_lock );
20262014 update_unbound_workqueue_cpumask (isolcpus_updated );
20272015
@@ -2105,8 +2093,6 @@ static void compute_partition_effective_cpumask(struct cpuset *cs,
21052093 */
21062094 spin_lock_irq (& callback_lock );
21072095 make_partition_invalid (child );
2108- cs -> nr_subparts -- ;
2109- child -> nr_subparts = 0 ;
21102096 spin_unlock_irq (& callback_lock );
21112097 notify_partition_change (child , old_prs );
21122098 continue ;
@@ -4021,7 +4007,6 @@ static void cpuset_handle_hotplug(void)
40214007 */
40224008 if (!cpumask_empty (subpartitions_cpus )) {
40234009 if (cpumask_subset (& new_cpus , subpartitions_cpus )) {
4024- top_cpuset .nr_subparts = 0 ;
40254010 cpumask_clear (subpartitions_cpus );
40264011 } else {
40274012 cpumask_andnot (& new_cpus , & new_cpus ,
0 commit comments