From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.220 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795920307; b=RNeHwqrUQXoLMIyK65hhLt5EDQ7z1WYiZXOd/j70V6bU1pItqOJh1EF1rO5GwZaNsTBv i1GOEwPp+0FZ6aZL0DBySCEwmdlmJDo5YAlJB647pShA44Qfk3uyTcW2x34cVcTetsUmC zbqJ16irdANVT1gojqO3qsqaxttOFQjuHnwo56LYfj8736oGghvN+WakU5GX+OMTCOyZv aOF+EsCHe77iq2hGa5GErzraQcEwH7dw6eo4KiXL2el0TpIkWg3JEu2L5p2E9o7JroiiO 6mQhn69+iijdS80qV2CJfh+XShgaQaopc6gFmqkK9qGbfSfWy5t9hqz3W+LN7Ka/StA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795920307; 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=cwVN/f9ty2X1KhO5JvTwDF/wtbahz65xEeKlhGWvtC0=; b=ikOmuEhbZEoj39Quf6I87bO65e17r68dGgEoAWgR4epYTvr0e8qapA7XafyzVd8c4qWA u5gXBbFTuDRkYdUo85gyEGDMl80egjyecmv20DRIzBRP3Gun84E8jDo5bB/y8Ie00a+Uz 2DYPKa/yae0EEsQv6EpjqfrX5Zl96PYfuxTSgrBMAT6eG8SQPUIfdfeG2VH/pKpkIE9rW C/swxQ5Buea+umlDU/mwMfGuoG/L134a7942XsYItEfnnerML1qZO4/I7wHTqNanV5Vj/ ckJPr6ebHcCg49D/cAGoLIAt1T4WqUjFPmWzFxTcIy1aPJYFryvC1oTUq7I4eQtOORA== 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=MExzHhEI; arc=none smtp.remote-ip=91.218.175.220 Received: from mta0.migadu.com (out-220.mta0.migadu.com [91.218.175.220]) (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 BF03F606A331 for ; Sun, 29 Nov 2026 02:45:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BF03F606A331 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=MExzHhEI X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=FFEMEgXKvuAEOSmrxfYjlEBZPOTEVnFq5iCUblFghlA=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1795920305; v=1; x=1796525105; b=MExzHhEIEHp4xByfbDdTmDlI/qbfiJPM3ZOc2NHGQu6i37BU3HLf1QeG7mteniLhnDOaqiSH pp/O5diur4oyIAk/8rYNkQt6CHgGlg2pQOi2WsbYQtSUKD7Pj3OmZnOcXyGNK1I7g2zhhmuxrFM A/anW1r8bNo18uLoWbrw7YQ4= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 4edd9acf589d660b; Sun, 29 Nov 2026 02:45:04 +0000 X-Mizu-Trace-ID: 4edd9acf589d660b 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 06/12] cpuset: use partition_update() for remote partition update Date: Sun, 29 Nov 2026 10:44:25 +0800 Message-Id: <20261129024431.2485721-7-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 Now that the partition_update() helper is available, use it to replace the existing remote partition update logic. This unifies the update path through a single centralized function. Signed-off-by: Ridong Chen --- kernel/cgroup/cpuset.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index f31512de9667..39d5b56f14b0 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -1837,8 +1837,8 @@ static void partition_disable(struct cpuset *cs, int new_prs, * partition, and the CPUs in tmp->delmask are given back to it. If that * parent is top_cpuset, subpartitions_cpus is updated accordingly. */ -static void __maybe_unused partition_update(struct cpuset *cs, int prs, struct cpumask *xcpus, - struct cpumask *excpus, struct tmpmasks *tmp) +static void partition_update(struct cpuset *cs, int prs, struct cpumask *xcpus, + struct cpumask *excpus, struct tmpmasks *tmp) { struct cpuset *parent; @@ -1940,7 +1940,6 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs, static void remote_cpus_update(struct cpuset *cs, struct cpumask *xcpus, struct cpumask *excpus, struct tmpmasks *tmp) { - bool adding, deleting; int prs = cs->partition_root_state; if (WARN_ON_ONCE(!is_remote_partition(cs))) @@ -1953,15 +1952,15 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *xcpus, goto invalidate; } - adding = cpumask_andnot(tmp->addmask, excpus, cs->effective_xcpus); - deleting = cpumask_andnot(tmp->delmask, cs->effective_xcpus, excpus); + cpumask_andnot(tmp->addmask, excpus, cs->effective_xcpus); + cpumask_andnot(tmp->delmask, cs->effective_xcpus, excpus); /* * Additions of remote CPUs is only allowed if those CPUs are * not allocated to other partitions and there are effective_cpus * left in the top cpuset. */ - if (adding) { + if (!cpumask_empty(tmp->addmask)) { enum prs_errcode err = prstate_housekeeping_conflict(prs, PRS_ROOT, excpus, tmp->delmask); @@ -1977,22 +1976,7 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *xcpus, } cs->remote_partition_updating = true; - spin_lock_irq(&callback_lock); - if (adding) - partition_xcpus_add(prs, NULL, tmp->addmask); - if (deleting) - partition_xcpus_del(prs, NULL, tmp->delmask); - /* - * 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); - if (adding || deleting) - cpuset_force_rebuild(); - + partition_update(cs, prs, xcpus, excpus, tmp); /* * Propagate changes in top_cpuset's effective_cpus down the hierarchy. */ -- 2.34.1