[PATCH] cgroup/cpuset: Make cpuset.cpus.effective independent of cpuset.cpus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Requiring cpuset.cpus.effective to be a subset of cpuset.cpus makes it
hard to use as one is forced to configure cpuset.cpus of current and all
ancestor cgroups, which requires a knowledge about all other units
sharing the same cgroup subtree. Also, it doesn't allow using empty
cpuset.cpus.

Do not require cpuset.cpus.effective to be a subset of cpuset.cpus and
create remote cgroup only if cpuset.cpus is empty, to make it easier for
the user to control which cgroup is being created.

Signed-off-by: Petr Malat <oss@xxxxxxxxx>
---
 kernel/cgroup/cpuset.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index b8000240a1476..72ec7ef0eabc8 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1459,7 +1459,7 @@ static bool compute_effective_exclusive_cpumask(struct cpuset *cs,
 		xcpus = cs->effective_xcpus;
 
 	if (!cpumask_empty(cs->exclusive_cpus))
-		cpumask_and(xcpus, cs->exclusive_cpus, cs->cpus_allowed);
+		cpumask_copy(xcpus, cs->exclusive_cpus);
 	else
 		cpumask_copy(xcpus, cs->cpus_allowed);
 
@@ -2987,18 +2987,13 @@ static int update_prstate(struct cpuset *cs, int new_prs)
 		 * cpus_allowed cannot be empty.
 		 */
 		if (cpumask_empty(cs->cpus_allowed)) {
+			if (remote_partition_enable(cs, &tmpmask))
+				goto out;
 			err = PERR_CPUSEMPTY;
-			goto out;
+		} else {
+			err = update_parent_effective_cpumask(cs,
+					partcmd_enable, NULL, &tmpmask);
 		}
-
-		err = update_parent_effective_cpumask(cs, partcmd_enable,
-						      NULL, &tmpmask);
-		/*
-		 * If an attempt to become local partition root fails,
-		 * try to become a remote partition root instead.
-		 */
-		if (err && remote_partition_enable(cs, &tmpmask))
-			err = 0;
 	} else if (old_prs && new_prs) {
 		/*
 		 * A change in load balance state only, no change in cpumasks.
-- 
2.42.0





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux