From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796094999; b=oHSOqYjMPO/AyEdsawXYXIQeDfas2wJ1A/E8Fjz39pdwvCSG+UlB68k+PtaoBSDv8xu8 uuKAHrURo162FQ96TK+33Gi0XzldDPZX3EoSBNkOWYpVC4H2D1qTWRpJvWJktB0prxENK C1ZWseIt3dxio5rbGCqCKImsBIR5fcFIFl2euHJP1nBpvTi0JgrTuD4UBFx3eTpVsBzMs gM7ntJr7kkBauACxFYt6i7ZeU9QYtqafkzOEpGExQqeX7Nic1ph8CAc/7ol4qnYb/X5fO splqTuRhXri3u6/C5dztHaAZ+Nbp+cSVB8HNTv4HXpbUmFsspbobGFqzr8QEhl7SmZw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796094999; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:Received:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-Scanned-By; bh=z/whevkw07h1czrlZlj6h0gaGqUaww7swPR0Snp2gz0=; b=AQyTHUHsHXSEe3M00R1hPNNHQc8oCX2TGlwCKdY0WHyPDyomwcUw3ufZ1tN2z+QtT256 Bk6fdYkZTEKdv8cuu2nufw+Y5g992/HuWdGr56mHpSLAClh4nLqrHvqj4PQLznPbGhysv 7MnFJqmQzibutrP75XZL8FckS7+43jfaFfBXCaQi4IT9EhnaUpVlwM6KnCdx+YAMiGr86 iDXEneHXApXPnjoXYpeV/F/K2wM3qd/D41CXRU+xXxjfYgPkR2y5hB9bWbhJph99Y30Cq YitZkiuFIA87TzyOm4NABAWV3v5c51snHW9831yu+3qK9uoyxO1UDaUVubP2oDB/yzg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ak+L8VSQ; arc=none smtp.remote-ip=170.10.129.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 263B3606A31A for ; Tue, 1 Dec 2026 03:16:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 263B3606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ak+L8VSQ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796094999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z/whevkw07h1czrlZlj6h0gaGqUaww7swPR0Snp2gz0=; b=ak+L8VSQjibbHllHMpeH2xJIujaJB+4XuOJs+SZZofA7ny6s9buIm0RwvDWzggiTs3DOoc 9CO4AgmZZwz1fBAPauiECwi0clbB6wwU484NtzmNlNF2Ju1b3VE6FlBQ2lDizt/mnWY6kW zpCWHYUWzZRj/Q+i9K0cO8OnolOSKNg= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-75-w7zqztRVPS2eh0a3coaTnQ-1; Tue, 1 Dec 2026 03:16:33 +0000 X-MC-Unique: w7zqztRVPS2eh0a3coaTnQ-1 X-Mimecast-MFC-AGG-ID: w7zqztRVPS2eh0a3coaTnQ_1796094992 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3FAFE195604F; Tue, 1 Dec 2026 03:16:32 +0000 (UTC) Received: from [100.91.18.181] (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E4AF418004F7; Tue, 1 Dec 2026 03:16:30 +0000 (UTC) Message-ID: Date: Mon, 30 Nov 2026 22:16:30 -0500 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 05/12] cpuset: use partition_disable() for remote partition disablement To: Ridong Chen , Tejun Heo , Johannes Weiner , =?UTF-8?Q?Michal_Koutn=C3=BD?= Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Ridong Chen References: <20261129024431.2485721-1-ridong.chen@linux.dev> <20261129024431.2485721-6-ridong.chen@linux.dev> Content-Language: en-US From: Waiman Long In-Reply-To: <20261129024431.2485721-6-ridong.chen@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 On 11/28/26 9:44 PM, Ridong Chen wrote: > From: Ridong Chen > > Now that the partition_disable() helper is available, replace the > existing implementation for remote partition disablement with this > centralized function to unify the disablement logic. > > remote_partition_disable() is removed and its callers call > partition_disable() directly. The new partition root state is passed > in by the caller instead of being derived from cs->prs_err, as only the > caller knows which state the partition is going to. > > Signed-off-by: Ridong Chen > --- > kernel/cgroup/cpuset.c | 58 ++++++------------------------------------ > 1 file changed, 8 insertions(+), 50 deletions(-) > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index 895e8aa455c1..f31512de9667 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -1774,9 +1774,8 @@ static void partition_enable(struct cpuset *cs, struct cpuset *parent, > * A valid partition gives its CPUs back to its parent (top_cpuset for a > * remote partition), and the change is propagated down the hierarchy. > */ > -static void __maybe_unused partition_disable(struct cpuset *cs, int new_prs, > - enum prs_errcode prs_err, > - struct tmpmasks *tmp) > +static void partition_disable(struct cpuset *cs, int new_prs, > + enum prs_errcode prs_err, struct tmpmasks *tmp) > { > struct cpuset *parent = is_remote_partition(cs) ? NULL : parent_cs(cs); > int old_prs = cs->partition_root_state; > @@ -1928,48 +1927,6 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs, > return 0; > } > > -/* > - * remote_partition_disable - Remove current cpuset from remote partition list > - * @cs: the cpuset to update > - * @tmp: temporary masks > - * > - * The effective_cpus is also updated. > - * > - * cpuset_mutex must be held by the caller. > - */ > -static void remote_partition_disable(struct cpuset *cs, struct tmpmasks *tmp) > -{ > - WARN_ON_ONCE(!is_remote_partition(cs)); > - /* > - * When a CPU is offlined, top_cpuset may end up with no available CPUs, > - * which should clear subpartitions_cpus. We should not emit a warning for this > - * scenario: the hierarchy is updated from top to bottom, so subpartitions_cpus > - * may already be cleared when disabling the partition. > - */ > - WARN_ON_ONCE(!cpumask_subset(cs->effective_xcpus, subpartitions_cpus) && > - !cpumask_empty(subpartitions_cpus)); > - > - spin_lock_irq(&callback_lock); > - cs->remote_partition = false; > - partition_xcpus_del(cs->partition_root_state, NULL, cs->effective_xcpus); > - if (cs->prs_err) > - cs->partition_root_state = -cs->partition_root_state; > - else > - cs->partition_root_state = PRS_MEMBER; > - > - /* effective_xcpus may need to be changed */ > - compute_excpus(cs, cs->effective_xcpus); > - reset_partition_data(cs); > - spin_unlock_irq(&callback_lock); > - cpuset_force_rebuild(); > - > - /* > - * Propagate changes in top_cpuset's effective_cpus down the hierarchy. > - */ > - cpuset_update_tasks_cpumask(&top_cpuset, tmp->new_cpus); > - update_sibling_cpumasks(&top_cpuset, NULL, tmp); > -} > - > /* > * remote_cpus_update - cpus_exclusive change of remote partition > * @cs: the cpuset to be updated > @@ -2045,7 +2002,7 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *xcpus, > return; > > invalidate: > - remote_partition_disable(cs, tmp); > + partition_disable(cs, -prs, cs->prs_err, tmp); > } > > /** > @@ -2663,7 +2620,8 @@ static void partition_cpus_change(struct cpuset *cs, struct cpuset *trialcs, > > if (is_remote_partition(cs)) { > if (trialcs->prs_err) > - remote_partition_disable(cs, tmp); > + partition_disable(cs, -cs->partition_root_state, > + cs->prs_err, tmp); > else > remote_cpus_update(cs, trialcs->exclusive_cpus, > trialcs->effective_xcpus, tmp); > @@ -3210,7 +3168,7 @@ static int update_prstate(struct cpuset *cs, int new_prs) > > if (disable_partition) { > if (is_remote_partition(cs)) > - remote_partition_disable(cs, &tmpmask); > + partition_disable(cs, PRS_MEMBER, PERR_NONE, &tmpmask); As noted by sashiko, this code path can be reached either when changing partition state to PRS_MEMBER or failing a partition state switch. So the call should be     partition_disable(cs, new_prs, err, &tmpmask); In the case of failed of partition state change, we have to negate new_prs too. Cheers, Longman > else > update_parent_effective_cpumask(cs, partcmd_disable, > NULL, &tmpmask); > @@ -4158,8 +4116,8 @@ static void cpuset_hotplug_update_tasks(struct cpuset *cs, struct tmpmasks *tmp) > if (is_remote_partition(cs) && (cpumask_empty(subpartitions_cpus) || > (cpumask_empty(&new_cpus) && > partition_is_populated(cs, NULL)))) { > - WRITE_ONCE(cs->prs_err, PERR_HOTPLUG); > - remote_partition_disable(cs, tmp); > + partition_disable(cs, -cs->partition_root_state, PERR_HOTPLUG, > + tmp); > compute_effective_cpumask(&new_cpus, cs, parent); > } >