# Re: \[PATCH v9 2/7\] cgroup/cpuset: Allow no-task partition to have empty cpuset.cpus.effective

- From: Tejun Heo \<tj@kernel.org\>
- Date: 2021-12-13 20:45:39 
- List: linux-doc
- Page: https://ratatoskr.run/linux-doc/2021/12/1607248
- Thread: https://ratatoskr.run/cgroups/2021/12/1596689/t.md

```text
On Sun, Dec 05, 2021 at 01:32:15PM -0500, Waiman Long wrote:
>  	adding = deleting = false;
>  	old_prs = new_prs = cpuset->partition_root_state;
>  	if (cmd == partcmd_enable) {
> +		/*
> +		 * Enabling partition root is not allowed if not all the CPUs
> +		 * can be granted from parent's effective_cpus.
> +		 */
> +		if (!cpumask_subset(cpuset->cpus_allowed, parent->effective_cpus))
> +			return -EINVAL;
> +
> +		/*
> +		 * A parent can be left with no CPU as long as there is no
> +		 * task directly associated with the parent partition. For
> +		 * such a parent, no new task can be moved into it.
> +		 */
> +		if (partition_is_populated(parent, cpuset) &&
> +		    cpumask_equal(cpuset->cpus_allowed, parent->effective_cpus))
> +			return -EINVAL;

So, given that this only happens with threaded domains, can we just not
allow partitions within threaded domains? The combination doesn't make whole
lot of sense to me anyway.

> +	/*
> +	 * On default hierarchy, task cannot be moved to a cpuset with empty
> +	 * effective cpus.
> +	 */
> +	if (is_in_v2_mode() && cpumask_empty(cs->effective_cpus))
> +		goto out_unlock;

And then we can avoid this extra restriction too, right?

Thanks.

-- 
tejun
```
