From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.219 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795920307; b=eXYTGfCj0tkx6QFc+12pyA3DBxB3nY+jNw+7Vb4D9fidcW0K4kW3UimZT4uSgJtUmgJ8 WAHynW3aJYE9FeYqJFjbHnzHNP/QqXHkq/blbudnKgB+b072wnhOlFjHjSy8m1jILUDFB f709OV7w5HATeQe/MnM2Iccvw+z0XTDRj01cZKTMt2aywsoj21cOllM/E0pM9Z2+hgLXs tVzxxUDXxN8eFjdXHuz1Tdw3HJv2g/Ft0amTfamWEnA3sW0ncYbnctq74bGvymLeETuZj GxUXa5wtNujS/8ZWPTQp6iBDBUuCondg9ZZuLwO06aUGDFPpRhpitKdipvEEeOOKgmQ== 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=xqQIP7k5sOQH0NDRn5Y77edzhyHn/lyFw/+L/BkDnl9bVxao8dSd7Fqae1xrjgu4+7PN qeoHBKEnPLIh3u8qAo5FWDRvvuagb7aWHfDtSQ+ZWTPv6NROqjNxDMsI+tLYJeMSA4hIZ LDEeP0gfYU99AdWW80o9ly+0VcxIdpY065tIkw5wubnPSxIC7+akvu9tlteWtvQr0K/MD H5fY6DSZUAWISnbhigx+zhMEqwptSfin0SXhk7UpmeT8iGjKW73XdEOV3ByYxC0/ziD6v z1bOOaZRJDYguBYnaIZu5cCGkM5VYjNbGB/u+nwOdEOi8+7/G3JSyDO4Z5vPJiip7dQ== 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=vkiiQiEM; arc=none smtp.remote-ip=91.218.175.219 Received: from mta0.migadu.com (out-219.mta0.migadu.com [91.218.175.219]) (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 B14F9606A687 for ; Sun, 29 Nov 2026 02:45:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B14F9606A687 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=vkiiQiEM X-Envelope-To: cgroups@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=1795920304; v=1; x=1796525104; b=vkiiQiEMACPpBj3gTj6y5qDHHNbLWZe9nY7vjA1k129B+EA9O0dwx+fObFt1U+AjsCg7wtrM 88DA9SrZ1URua8zE2aTTGOM7XK9zyN00a5W18iSAK3M0H+ePSHLzeM81oUgxD9do/1RgYmg34nX Uc3uoERNHK/LLTs/mUOtNnPI= X-Envelope-To: cgroups@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: 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 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