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: <91e163ac-4379-4875-9f08-bddebb1e616c@redhat.com>
Date: Wed, 12 Nov 2025 15:58:04 -0500
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 RFC v2 06/22] cpuset: introduce partition_update()

On 10/25/25 2:48 AM, Chen Ridong wrote:
> From: Chen Ridong <chenridong@...wei.com>
>
> Introduce partition_update() to centralize updates to key cpuset structures
> during a partition update, including:
> - effective_xcpus
> - exclusive_cpus
>
> Key operations performed:
> - Adding and removing exclusive CPUs via partition_xcpus_add()/del()
> - Synchronizing the effective exclusive CPUs mask
> - Updating the exclusive CPUs mask when modification is required
> - Triggering necessary system updates and workqueue synchronization
> - Updating the partition's exclusive flag
> - Sending partition change notifications
>
> Signed-off-by: Chen Ridong <chenridong@...wei.com>
> ---
>   kernel/cgroup/cpuset.c | 47 ++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 47 insertions(+)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 4a79db1cdec1..3e414e19ae31 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -1604,6 +1604,53 @@ static void partition_disable(struct cpuset *cs, struct cpuset *parent,
>   	notify_partition_change(cs, old_prs);
>   }
>   
> +/**
> + * partition_update - Update an existing partition configuration
> + * @cs: The cpuset to update
> + * @prs: Partition root state (must be positive)
> + * @xcpus: New exclusive CPUs mask for the partition (NULL to keep current)
> + * @excpus: New effective exclusive CPUs mask
> + * @tmp: Temporary masks
> + *
> + * Updates partition-related fields. The tmp->addmask is the CPU mask that
> + * will be added to the subpartitions_cpus and removed from parent's
> + * effective_cpus, and the tmp->delmask vice versa.
> + */
> +static void partition_update(struct cpuset *cs, int prs, struct cpumask *xcpus,
> +				  struct cpumask *excpus, struct tmpmasks *tmp)
> +{
> +	bool isolcpus_updated;
> +	bool excl_updated;
> +	struct cpuset *parent;
> +	int old_prs;
> +
> +	lockdep_assert_held(&cpuset_mutex);
> +	WARN_ON_ONCE(!cpuset_v2());
> +	WARN_ON_ONCE(prs <= 0);
> +
> +	parent = is_remote_partition(cs) ? NULL : parent_cs(cs);
> +	old_prs = cs->partition_root_state;
> +	excl_updated = !cpumask_empty(tmp->addmask) ||
> +		       !cpumask_empty(tmp->delmask);
Should partition_update() only be called if at least one of 
addmask/delmask is not empty? If they are both empty, no update is 
really needed. Right?
> +
> +	spin_lock_irq(&callback_lock);
> +	isolcpus_updated = partition_xcpus_add(prs, parent, tmp->addmask);
> +	isolcpus_updated |= partition_xcpus_del(prs, parent, tmp->delmask);

I see now that there is no adding and deleting boolean flags to indicate 
if the cpumasks are empty or not, so you have to add the empty cpumask 
check in those helpers. Please state that in your patch 2.

Cheers,
Longman

> +	/*
> +	 * Need to update effective_xcpus and exclusive_cpus now as
> +	 * update_sibling_cpumasks() below may iterate back to the same cs.
> +	 */
> +	cpumask_copy(cs->effective_xcpus, excpus);
> +	if (xcpus)
> +		cpumask_copy(cs->exclusive_cpus, xcpus);
> +	spin_unlock_irq(&callback_lock);
> +	update_unbound_workqueue_cpumask(isolcpus_updated);
> +	if (excl_updated)
> +		cpuset_force_rebuild();
> +	update_partition_exclusive_flag(cs, prs);
> +	notify_partition_change(cs, old_prs);
> +}
> +
>   /*
>    * prstate_housekeeping_conflict - check for partition & housekeeping conflicts
>    * @prstate: partition root state to be checked


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ