lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <be3275f5-a825-42bd-bf36-3d92387d0b50@redhat.com>
Date: Fri, 29 Aug 2025 15:29:32 -0400
From: Waiman Long <llong@...hat.com>
To: Chen Ridong <chenridong@...weicloud.com>, tj@...nel.org,
 hannes@...xchg.org, mkoutny@...e.com
Cc: cgroups@...r.kernel.org, linux-kernel@...r.kernel.org,
 lujialin4@...wei.com, chenridong@...wei.com
Subject: Re: [PATCH -next RFC 06/11] cpuset: introduce cpus_excl_conflict and
 mems_excl_conflict helpers


On 8/28/25 8:56 AM, Chen Ridong wrote:
> From: Chen Ridong <chenridong@...wei.com>
>
> This patch adds cpus_excl_conflict() and mems_excl_conflict() helper
> functions to improve code readability and maintainability. The exclusive
> conflict checking follows these rules:
>
> 1. If either cpuset has the 'exclusive' flag set, their user_xcpus must
>     not have any overlap.
> 2. If both cpusets are non-exclusive, their 'cpuset.cpus.exclusive' values
>     must not intersect.
Do you mean "both cpusets are exclusive"?
> 3. The 'cpuset.cpus' of one cpuset must not form a subset of another
>     cpuset's 'cpuset.cpus.exclusive'.
>
> Signed-off-by: Chen Ridong <chenridong@...wei.com>
> ---
>   kernel/cgroup/cpuset.c | 62 ++++++++++++++++++++++--------------------
>   1 file changed, 32 insertions(+), 30 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 5dd1e9552000..5cfc53fe717c 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -584,6 +584,35 @@ static inline bool cpusets_are_exclusive(struct cpuset *cs1, struct cpuset *cs2)
>   	return true;
>   }
>   
> +static inline bool cpus_excl_conflict(struct cpuset *cs1, struct cpuset *cs2)
> +{
> +	/* One is exclusive, they must be exclusive */
The comment is hard to understand. Basically, if one cpuset has 
exclusive flag set (a v1 feature), they must be exclusive wrt each other.
> +	if (is_cpu_exclusive(cs1) || is_cpu_exclusive(cs2))
> +		return !cpusets_are_exclusive(cs1, cs2);
> +
> +	/* Exclusive_cpus can not have intersects*/
Grammatical mistake, better wording - "exclusive_cpus cannot intersect"
> +	if (cpumask_intersects(cs1->exclusive_cpus, cs2->exclusive_cpus))
> +		return true;
> +
> +	/* One cpus_allowed can not be a subset of another's cpuset.effective_cpus */
"cpus_allowed of one cpuset cannot be a subset of another cpuset's 
exclusive_cpus"
> +	if (!cpumask_empty(cs1->cpus_allowed) &&
> +	    cpumask_subset(cs1->cpus_allowed, cs2->exclusive_cpus))
> +		return true;
> +
> +	if (!cpumask_empty(cs2->cpus_allowed) &&
> +	    cpumask_subset(cs2->cpus_allowed, cs1->exclusive_cpus))
> +		return true;
> +
> +	return false;
> +}
> +
Cheers,
Longman


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ