From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.230 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795920323; b=MID9czUJmglnsYLedRM9hsyDyP3qxL2dElyJtDYPtvGEs6U77xu+LvN83JRQy+hzjvYA nrGzdumiwws8R6lgA/0z5BfXEkPjhPUn3PrjUaPaQfiNFTybKQ+Kt7EXXHA6RFh3WrRij uMTUBLyFupLMhakCIdr076E1w7s7ryBNiVAMltKJWA7ZnFQa53lBKJiUdusqE4SIKALxh vqf4baokFOcUQvu8WZQCdYE21hiq5Y3TWzH69twwcnHWQ1pKr8e3mFqxvM6+3QaZmdiKY SfvOlNWf9kMnt3pY12XZDF6ocZH56fHonZCk5MMX88nljclQl3LNkVKepLe57JDCSsQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795920323; 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=4JqP5SP2/xGJAvbKTZyTWJBUI9SJ+/I5D81Y5ErrYIOI3zfomIfvd6uAJUo1hU9RnLNs KbgMVZKgHo8LRmwlB3px8KMHiAYRcsw2DGWyMd2jJSGJxgDTEv/yynDsKCmOr3V2EZ6PL +7JZi8zCQgQdfWuFStpjxGVbf+c/PHKaczFTDR/LYnpP7NX6xY0WRELOvuJNSmohgGH2J H69l+itR7tYdH55uma3egOYpQpISAumPAF2n2S763RDm9XZmWEC/oxs7zEhGefqJVnDQF FSdDN9JFPVOTAdw2M+bKiR+wDuMWfRBY15+TehGYR9lbO87QC8SyXtwSqeAHEzk/HGw== 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=91.218.175.230 Received: from mta0.migadu.com (out-230.mta0.migadu.com [91.218.175.230]) (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 404B4606A31C for ; Sun, 29 Nov 2026 02:45:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 404B4606A31C 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: linux-kernel@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: linux-kernel@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: linux-kernel@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