From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384938; b=NE7YUNCPiLIMtJtK5oYZgk+RQbqGNw/iG4VXHqo1mKIR4pEnWf4ZNv3xZYq/66jPiXh9 6PrfHiE8WjNQM3DEJGG2qey8UO4wTXYtzIjjEtMSOEqeQl+rwDJuYBoPKc8PYsaDQTr/r w10MT6guVWZ05aTTSKWtj/5V9MkppPXmsJP2Gli4Donrn2+v3bPSjtto92RrLZ0uaIJWR 7PfwRPcW4dTO1/8oebtoO2Zm+Kqv9jiKE+kQNERu6syL4xvtOkV9NsMRnJwaL2WiNglSQ pdfE8bK9IADtiGEfZh+PgY+jUEbMU0PkkLnpsfmnMFYFgSc6LewAbcHLQS1BjwWh+Fw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384938; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=aiihF9srUA70d5n6Sm6lj6UlsQhNcXZ+ecuUyivrW/o=; b=UEmc1FJxL6XBH9pO52GvAz2oEz1kveXmoHpEEKAB+Y3yIXLRHRlX1Rnd+tv7WVs2Z+bz GoHVWNdvFAhzs9gz4MEKjmer+a5Tojs5bfBGXaxN3xYNaBmvlCObNxSK+Y94j5kITEWKb NuidRCE0MhGmN8mJubrbpgKHrwiCljXQaWiz0uv4H23P25tw0Xm88Cn2r6BUCIj8rsH0p 9pz2gUkY1RR8giG867VSvdAjzqEXDr49GN7o10+Tfw9oKKtKi+3xWBjojtF7F7Uqwytod gfpzJxWvlRemqyZBn0z8cR+1PJostXJUvywyetLBTWMAipzu/gOwuWWevIKmyXOfx5A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Y+BoB22g; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63D16606A322; Fri, 4 Dec 2026 11:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Y+BoB22g Received: by smtp.kernel.org (Postfix) with ESMTPSA id 464A01F00933; Fri, 4 Dec 2026 11:48:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384937; bh=aiihF9srUA70d5n6Sm6lj6UlsQhNcXZ+ecuUyivrW/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Y+BoB22gCmpdLUzPpWk06/L3GfzXj7udWAWeAFitE8Xjxj43e2Oe01psdg0Yi/cdA 85ZGcxsStPkLFF1/IVm/TCOZKnlZurY/9IJPM1XbLdZ9U0SEYtqYcIDpeKLs8DlPaO G9htDP7CT49tuyfP+C0+PiE+lsE+PSsCpg+FRRWU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Waiman Long , Ridong Chen , Guopeng Zhang , Tejun Heo , Sasha Levin Subject: [PATCH 6.6 0354/1167] cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root only Date: Fri, 4 Dec 2026 18:56:21 +0900 Message-ID: <20261204100711.211355686@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@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 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Waiman Long [ Upstream commit 8a1c0f5c82843104d9bef2bc3726c89da70a9b91 ] Commit f82f80426f7a ("sched/deadline: Ensure that updates to exclusive cpusets don't break AC") adds a check in validate_change() to make sure that there is enough bandwidth for SCHED_DEADLINE tasks if we shrink a v1 exclusive cpuset that has CS_CPU_EXCLUSIVE flag set. With the introduction of cpuset partition in cgroup v2, we keep setting the CS_CPU_EXCLUSIVE flag for a partition root so that the SCHED_DEADLINE check will continue to work as intended. However it turns out that the current code isn't perfect and there are cases where a cpuset isn't a valid partition root, but the exclusive flag is still incorrectly set. This can leads to SCHED_DEADLINE check being incorrectly triggered when there are deadline tasks in the system. This can result in unexpected -EBUSY failure when making changes to cpuset control files. Fix that by checking for a valid partition root for v2 and is_cpu_exclusive() for v1. It is far easier and less cumbersome than to make sure that the exclusive flag is only set for valid partition roots. Even though commit a86ce68078b2 ("cgroup/cpuset: Extract out CS_CPU_EXCLUSIVE & CS_SCHED_LOAD_BALANCE handling") is marked as a commit to be fixed, the problem may exist before that. Fixes: a86ce68078b2 ("cgroup/cpuset: Extract out CS_CPU_EXCLUSIVE & CS_SCHED_LOAD_BALANCE handling") Signed-off-by: Waiman Long Reviewed-by: Ridong Chen Reviewed-by: Guopeng Zhang Signed-off-by: Tejun Heo [ sashal: Replaced upstream's cpuset_v2() with cgroup_subsys_on_dfl(cpuset_cgrp_subsys), and adapted to the older condition, which lacked is_sched_load_balance() and used cpus_allowed. ] Signed-off-by: Sasha Levin --- kernel/cgroup/cpuset.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 7ccc0c3845ccf..ad1727f3390e7 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -591,7 +591,9 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial) * tasks. */ ret = -EBUSY; - if (is_cpu_exclusive(cur) && + if ((is_partition_valid(cur) || + (!cgroup_subsys_on_dfl(cpuset_cgrp_subsys) && + is_cpu_exclusive(cur))) && !cpuset_cpumask_can_shrink(cur->cpus_allowed, trial->cpus_allowed)) goto out; -- 2.53.0