From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.211 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795920324; b=w6DJgS1DvAuUlx6M7rNGwjir/Lg5MbBC97n6ps3cUKee8RtgVK49DiNeDCvTq5LQxdy6 Bbve9+2eeu5bjNjF7jWptblBzlHPNMJpZ+5WW/OY2J4U+zQMUTYvzkSfyqtlIdEHF4BRy l08NDoEXnBa+Chi12JIIWbMAVQPFvF5lDhdVjklbbPbzebPnFuaXOmwipx+5gfbHxu2iL bBb3OTy3EhISuFaxLoTlE4dd+RwEQzxJ+WgHl1hK9bA0d+J9pOw0oovYAwVwTs8SQ9Y6t y1hgVmRIsBddHO7H7XaUf0NkrnH21Lkyqiz+3jUmDmZZCY84svyFEO1Z7ENfM83fVSQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795920324; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-Id: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=Gpi9oNFZ/s+Dyj6pLdcvCcu02b9ssOSu34m6qTmMps8=; b=fZflJxZr1T2OARUHac0fxstsbJcf2z8yeOdEKhGudhuW6ro0OzD7ZlINB86fVkZNQHAf MpH39n/o2yvbNqm3WTzhHO1nV/kkdBx3+Rx6kM/pQGzlLBXQdolq4hQwztVOB2Z/SZmg+ wrFor+KB3OU9TsMKVZPI8YsOUdpuPMvQ9B/JAEZEvQ4lYhsOU7cNvb12pfNWJ8FrsdQrM 5V+T3VdHv9Kx3jGYy/XM6znB1H/11tQmm3CRYrxafKxq+dVorbDthDcx8UBjkE/GpWWmp paJ9KUqUpekPUp40XdcSeQmWFrtkNHfgVfrmPR/M4mSXitb5GD8Nkh/WySj65VjXvXw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=lkWawOeu; arc=none smtp.remote-ip=95.215.58.211 Received: from mta1.migadu.com (out-211.mta1.migadu.com [95.215.58.211]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 689A1606A324 for ; Sun, 29 Nov 2026 02:45:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 689A1606A324 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=lkWawOeu X-Envelope-To: cgroups@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=m53u5wk0FoybwTVkuFKTUFKOmiFJlFubj2gVp1JhLQM=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1795920321; v=1; x=1796525121; b=lkWawOeuoQ6le85yq2e2jouzS0l8HDWDe6/YzxC251fZMS4SzgX84GvUUGelamuOHH2ekczF sDRXJPaUD4+d8R5N38fLogm3p4UoSbm8jElKWz16S1k6CzQcejaZxWPTAa9UTQEuxSrYw5rcq+t WnTcPv+0x03q5W+Ek3yPQgng= X-Envelope-To: cgroups@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 0398580aa3dd3ce5; Sun, 29 Nov 2026 02:45:19 +0000 X-Mizu-Trace-ID: 0398580aa3dd3ce5 X-Migadu-Flow: FLOW_OUT From: Ridong Chen To: Waiman Long , Tejun Heo , Johannes Weiner , =?UTF-8?q?Michal=20Koutn=C3=BD?= Cc: Ridong Chen , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Ridong Chen Subject: [PATCH v6 10/12] cpuset: use partition_disable() to invalidate local partition Date: Sun, 29 Nov 2026 10:44:29 +0800 Message-Id: <20261129024431.2485721-11-ridong.chen@linux.dev> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261129024431.2485721-1-ridong.chen@linux.dev> References: <20261129024431.2485721-1-ridong.chen@linux.dev> X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Ridong Chen Use partition_disable() to handle local partition invalidation as well, replacing partcmd_invalidate in partition_cpus_change(). An invalid partition has already given back its CPUs, so partition_cpus_change() leaves it alone. cpuset_hotplug_update_tasks() is converted later together with the partition revival, by local_partition_update(). As partition_disable() resets the partition data, the effective_xcpus of an invalid partition is no longer kept. When update_parent_effective_cpumask() turns an invalid partition back into a valid one, use partition_enable() to set up effective_xcpus and the partition state again. Signed-off-by: Ridong Chen --- kernel/cgroup/cpuset.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index e226d89004fe..a32bf85e48ad 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -2363,20 +2363,28 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd, * Newly added CPUs will be removed from effective_cpus and * newly deleted ones will be added back to effective_cpus. */ - spin_lock_irq(&callback_lock); - if (old_prs != new_prs) - cs->partition_root_state = new_prs; + if (old_prs < 0 && new_prs > 0) { + /* + * An invalid partition becomes valid again, its effective_xcpus + * was cleared or recomputed when it was invalidated. + */ + partition_enable(cs, parent, new_prs, tmp->delmask); + } else { + spin_lock_irq(&callback_lock); + if (old_prs != new_prs) + cs->partition_root_state = new_prs; - /* - * Adding to parent's effective_cpus means deletion CPUs from cs - * and vice versa. - */ - if (adding) - partition_xcpus_del(old_prs, parent, tmp->addmask); - if (deleting) - partition_xcpus_add(new_prs, parent, tmp->delmask); + /* + * Adding to parent's effective_cpus means deletion CPUs from cs + * and vice versa. + */ + if (adding) + partition_xcpus_del(old_prs, parent, tmp->addmask); + if (deleting) + partition_xcpus_add(new_prs, parent, tmp->delmask); - spin_unlock_irq(&callback_lock); + spin_unlock_irq(&callback_lock); + } if (adding || deleting) { cpuset_update_tasks_cpumask(parent, tmp->addmask); @@ -2680,12 +2688,12 @@ static void partition_cpus_change(struct cpuset *cs, struct cpuset *trialcs, remote_cpus_update(cs, trialcs->exclusive_cpus, trialcs->effective_xcpus, tmp); } else { - if (trialcs->prs_err) - update_parent_effective_cpumask(cs, partcmd_invalidate, - NULL, tmp); - else + if (!trialcs->prs_err) update_parent_effective_cpumask(cs, partcmd_update, trialcs->effective_xcpus, tmp); + else if (is_partition_valid(cs)) + partition_disable(cs, -cs->partition_root_state, + trialcs->prs_err, tmp); } } -- 2.34.1