From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.125 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793533481; b=a7/UF8krNIqngYYXHP4H/vq1+8VMXBI9QyNy80YWIKZxi3yagBp3tdMSLFpVY6qc+TMC 08iKlzZqNET9r76CzEAFO7tdIuouVkzw5/oNag5wukCTx2QWqdUTKioHjKCNhxv3aOb4S bvGCQEj55sYXYMGl8D6o/UjxD/rC0AvHeeHWd9ehe3SJDnxKEqozKAaIIw+d4hdU0iNte QRfkteFkTLr5xrhvQCOjngpVCvihCgFRKQa39CPoxBf0hQuZDwp6Bp1gxQ76u1MXbdQJy KDUIXiTCxXpxEy5GqzpQhyrD/KpeZoO5UNdp963IoaNJ5/6Doxz6/Xu+1+5bSvj3i6A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793533481; 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=jl9q1kPvpfXB9rbcCqx0sRzDo6NRaZhx8sXojJnTnwg=; b=45YwmaRYWxoOT2mn6QE7Z10Eo6zy4F8tBTZiWvxiWym/0A0JefpQn+PCvwusi73TMiek mJMFhko9c9zqGJW5ocLj1GVswFseoUN3Z0UxvNekTlAlRkFYJGlZIldMH8PEiHMKay44N T+EaU2vPl3UY3qYm8hKrRIDPKmmvZO6gsGpGUzrnuq1py9erT7NQzNV+Jsi7ju/AC8BH4 2fYUkatQP6IlAJVD0RCf4fC9aOZgwxQ6SQkfLQMj0nCPZcdgDeKm4/S/dNkjkBNu8gqtt V8T5NeTNFKgfOr5JowHsHEPoFN2SvyXQBqRIqfSvEJpVT1q7r/IOAPDBrb9n4nEXMHA== 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=BYLOWrtK; arc=none smtp.remote-ip=91.218.175.125 Received: from mta0.migadu.com (out-125.mta0.migadu.com [91.218.175.125]) (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 D4932606A324 for ; Sun, 1 Nov 2026 11:44:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D4932606A324 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=BYLOWrtK X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=Wjdn3OQDASdFAWwR2LojczAo2YM/KVjt+TBzyDBfQuE=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1793533479; v=1; x=1794138279; b=BYLOWrtKLi/cVO7pkaEGihlE8UGYNxSFo15fPhOt6HnuUjrV0KDpeZATrH1HmjJuTwjNHf+L t8s3lkIIPT+O+RE2aSMpwV4oXfwLNw8bCoKIX9NxKOx5m0npy6Ww1fKb1PFfO9H3xFf+jrQIoJS sTmwRUy3n0KblRfvhTxYdCaE= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id efbb9dede1c58fb4; Sun, 01 Nov 2026 11:44:39 +0000 X-Mizu-Trace-ID: efbb9dede1c58fb4 X-Migadu-Flow: FLOW_OUT From: Ridong Chen To: Waiman Long , Tejun Heo , Johannes Weiner , "Michal Koutn?" Cc: Guopeng Zhang , Ridong Chen , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Chen Ridong , Ridong Chen Subject: [RFC PATCH -v4 17/22] cpuset: use partition_disable for compute_partition_effective_cpumask Date: Sun, 1 Nov 2026 19:42:01 +0800 Message-Id: <20261101114206.2434398-18-ridong.chen@linux.dev> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261101114206.2434398-1-ridong.chen@linux.dev> References: <20261101114206.2434398-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: Chen Ridong Replace the partition invalidation logic in the compute_partition_effective_cpumask() with a call to partition_disable(). This centralizes partition state management and ensures consistent handling of partition disable operations throughout the cpuset subsystem. The isolated_cpus update that was open-coded here is now done by partition_xcpus_del() called from partition_disable(). In addition, partition_disable() gives the exclusive CPUs of the invalidated child back to the parent and resets the partition data of the child, the same as other partition invalidation paths. Signed-off-by: Chen Ridong Signed-off-by: Ridong Chen --- kernel/cgroup/cpuset.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 00afa4987381..af42666d4530 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -1137,6 +1137,8 @@ void cpuset_update_tasks_cpumask(struct cpuset *cs, struct cpumask *new_cpus) static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, struct tmpmasks *tmp); +static void partition_disable(struct cpuset *cs, struct cpuset *parent, + int new_prs, enum prs_errcode prs_err); /* * Update partition load balance flag and/or rebuild sched domain @@ -1642,20 +1644,9 @@ static void compute_partition_effective_cpumask(struct cpuset *cs, */ WARN_ON_ONCE(is_remote_partition(child)); if (populated && cpumask_subset(new_ecpus, child->effective_xcpus)) { - int old_prs = child->partition_root_state; - int parent_prs = cs->partition_root_state; - - /* - * Invalidate child partition. Its CPUs, including those - * further distributed to its descendants, take the - * isolation state of cs. - */ - spin_lock_irq(&callback_lock); - WRITE_ONCE(child->prs_err, PERR_NOCPUS); - isolated_cpus_set_state(parent_prs, child->effective_xcpus); - child->partition_root_state = -old_prs; - spin_unlock_irq(&callback_lock); - notify_partition_change(child, old_prs); + /* Invalidate child partition */ + partition_disable(child, cs, -child->partition_root_state, + PERR_NOCPUS); continue; } cpumask_andnot(new_ecpus, new_ecpus, -- 2.34.1