mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <llong@redhat.com>
To: Chen Ridong <chenridong@huaweicloud.com>,
	tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com
Cc: cgups@vger.kernel.org, linux-kernel@vger.kernel.org,
	lujialin4@huawei.com, chenridong@huawei.com
Subject: Re: [PATCH -next RFC 13/16] cpuset: use partition_disable for compute_partition_effective_cpumask
Date: Sun, 19 Oct 2025 23:02:04 -0400	[thread overview]
Message-ID: <21d14cb8-3c8f-45cd-abdd-961271d537da@redhat.com> (raw)
In-Reply-To: <20250928071306.3797436-14-chenridong@huaweicloud.com>


On 9/28/25 3:13 AM, Chen Ridong wrote:
> From: Chen Ridong <chenridong@huawei.com>
>
> Replace the partition invalidation logic in the
> compute_partition_effective_cpumask() with a call to partition_disable().
>
> This centralizes partition state management and ensures consistent
> handling of partition disable operations throughout the cpuset subsystem.
>
> Signed-off-by: Chen Ridong <chenridong@huawei.com>
> ---
>   kernel/cgroup/cpuset.c | 28 +++++++---------------------
>   1 file changed, 7 insertions(+), 21 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 6625b803ba02..20288dbd6ccf 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -170,15 +170,6 @@ static inline bool cs_is_member(const struct cpuset *cs)
>   	return cs->partition_root_state == PRS_MEMBER;
>   }
>   
> -/*
> - * Callers should hold callback_lock to modify partition_root_state.
> - */
> -static inline void make_partition_invalid(struct cpuset *cs)
> -{
> -	if (cs->partition_root_state > 0)
> -		cs->partition_root_state = -cs->partition_root_state;
> -}
> -
>   /*
>    * Send notification event of whenever partition_root_state changes.
>    */
> @@ -2073,6 +2064,7 @@ static void compute_partition_effective_cpumask(struct cpuset *cs,
>   	struct cgroup_subsys_state *css;
>   	struct cpuset *child;
>   	bool populated = partition_is_populated(cs, NULL);
> +	enum prs_errcode prs_err;
>   
>   	/*
>   	 * Check child partition roots to see if they should be
> @@ -2095,26 +2087,20 @@ static void compute_partition_effective_cpumask(struct cpuset *cs,
>   		 * partition root.
>   		 */
>   		WARN_ON_ONCE(is_remote_partition(child));
> -		child->prs_err = 0;
> +		prs_err = 0;
>   		if (!cpumask_subset(child->effective_xcpus,
>   				    cs->effective_xcpus))
> -			child->prs_err = PERR_INVCPUS;
> +			prs_err = PERR_INVCPUS;
>   		else if (populated &&
>   			 cpumask_subset(new_ecpus, child->effective_xcpus))
> -			child->prs_err = PERR_NOCPUS;
> -
> -		if (child->prs_err) {
> -			int old_prs = child->partition_root_state;
> +			prs_err = PERR_NOCPUS;
>   
> +		if (prs_err) {
>   			/*
>   			 * Invalidate child partition
>   			 */
> -			spin_lock_irq(&callback_lock);
> -			make_partition_invalid(child);
> -			cs->nr_subparts--;
> -			child->nr_subparts = 0;
> -			spin_unlock_irq(&callback_lock);
> -			notify_partition_change(child, old_prs);
> +			partition_disable(child, parent_cs(child),

The parent of child should just be cs. You don't need to use parent_cs() 
to get it.

Cheers,
Longman


> +					  -child->partition_root_state, prs_err);
>   			continue;
>   		}
>   		cpumask_andnot(new_ecpus, new_ecpus,


  reply	other threads:[~2025-10-20  3:02 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-28  7:12 [PATCH -next RFC 00/16] cpuset: rework local partition logic Chen Ridong
2025-09-28  7:12 ` [PATCH -next RFC 01/16] cpuset: use update_partition_sd_lb in update_cpumasks_hier Chen Ridong
2025-10-20  2:37   ` Waiman Long
2025-10-20  7:30     ` Chen Ridong
2025-09-28  7:12 ` [PATCH -next RFC 02/16] cpuset: generalize validate_partition() interface Chen Ridong
2025-09-28  7:12 ` [PATCH -next RFC 03/16] cpuset: factor out partition_enable() function Chen Ridong
2025-10-20  2:39   ` Waiman Long
2025-10-20  7:48     ` Chen Ridong
2025-10-20 19:42       ` Waiman Long
2025-10-21  0:52         ` Chen Ridong
2025-09-28  7:12 ` [PATCH -next RFC 04/16] cpuset: factor out partition_disable() function Chen Ridong
2025-09-28  7:12 ` [PATCH -next RFC 05/16] cpuset: factor out partition_update() function Chen Ridong
2025-10-20  2:43   ` Waiman Long
2025-10-20  8:05     ` Chen Ridong
2025-10-20 19:45       ` Waiman Long
2025-09-28  7:12 ` [PATCH -next RFC 06/16] cpuset: introduce local_partition_enable() Chen Ridong
2025-10-20  2:44   ` Waiman Long
2025-10-20  8:06     ` Chen Ridong
2025-09-28  7:12 ` [PATCH -next RFC 07/16] cpuset: introduce local_partition_disable() Chen Ridong
2025-10-20  2:46   ` Waiman Long
2025-10-20  8:06     ` Chen Ridong
2025-09-28  7:12 ` [PATCH -next RFC 08/16] cpuset: introduce local_partition_invalidate() Chen Ridong
2025-10-20  2:48   ` Waiman Long
2025-10-20  8:28     ` Chen Ridong
2025-09-28  7:12 ` [PATCH -next RFC 09/16] cpuset: introduce local_partition_update() Chen Ridong
2025-10-20  2:57   ` Waiman Long
2025-10-20  9:24     ` Chen Ridong
2025-09-28  7:13 ` [PATCH -next RFC 10/16] cpuset: remove redundant partition field updates Chen Ridong
2025-09-28  7:13 ` [PATCH -next RFC 11/16] cpuset: simplify partition update logic for hotplug tasks Chen Ridong
2025-10-20  3:00   ` Waiman Long
2025-10-20  8:44     ` Chen Ridong
2025-09-28  7:13 ` [PATCH -next RFC 12/16] cpuset: unify local partition disable and invalidate Chen Ridong
2025-09-28  7:13 ` [PATCH -next RFC 13/16] cpuset: use partition_disable for compute_partition_effective_cpumask Chen Ridong
2025-10-20  3:02   ` Waiman Long [this message]
2025-10-20  8:47     ` Chen Ridong
2025-09-28  7:13 ` [PATCH -next RFC 14/16] cpuset: fix isolcpus stay in root when isolated partition changes to root Chen Ridong
2025-10-20  3:06   ` Waiman Long
2025-10-20  9:13     ` Chen Ridong
2025-10-22 10:49     ` Chen Ridong
2025-09-28  7:13 ` [PATCH -next RFC 15/16] cpuset: use partition_disable for update_prstate Chen Ridong
2025-09-28  7:13 ` [PATCH -next RFC 16/16] cpuset: remove prs_err clear when notify_partition_change Chen Ridong
2025-09-28  9:57 ` [PATCH -next RFC 00/16] cpuset: rework local partition logic Chen Ridong
2025-09-28 16:00 ` Waiman Long
2025-09-29  1:17   ` Chen Ridong
2025-10-17  1:05   ` Chen Ridong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=21d14cb8-3c8f-45cd-abdd-961271d537da@redhat.com \
    --to=llong@redhat.com \
    --cc=cgups@vger.kernel.org \
    --cc=chenridong@huawei.com \
    --cc=chenridong@huaweicloud.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lujialin4@huawei.com \
    --cc=mkoutny@suse.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®