From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.127.230.115 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796302783; b=Riw2tBmpnjJ/fusUyFXkkQm8P6Wn7Ona2LG6ZBswfOMlEeJYiQxqA2dVbj9x4uaiT720 tHMXY2Skv9n0DA7w6Y4cfoqzIq10SWPuM4Im+cd6qhzgLr8WcAjo5BEzI/gFm4wQh1lGR Ybt+tZ2Xryx906n0FuTfAve7MordIbJ8WawzCNLF7q3F2X9otJ19svuiwe8mIyziCehZv NELrosCgVs0D4RaPWOrHw7OVtSefEkh2t6uLzKS8v8UjrzhPfvNbrkpQ/0bX03csS14p1 FdekB5gjhr2fy0aoSmLvzSyblyBkgOysvkKfRObDero4XbFHbhQNArzpS9xWpaibwlw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796302783; h=DMARC-Filter:DKIM-Signature:Subject:Mime-Version:Content-Type: User-Agent:Cc:From:X-Original-From:X-Lms-Return-Path:References: Content-Transfer-Encoding:To:Date:Message-Id:In-Reply-To; bh=LHMNIz/t7bygstMV8D+rco5YlmKtWdqsIaZdNlttzf4=; b=EKjzbvYYmJOKv7IUlsgpj8iDSCN/F1DELdtnot9J14wbqQBBtNsf1T9afdy9eeuRNcTx p1f/ZbDYLTfv+kR8hGnYZZvkFcIxp7FoPEUY75CHUFiNGZ7Hq58Q1CCXvaxmMKX2J/9Ar J3aOGKBxUziVx4RBEQBhkhZAfk4HxyIBJ9vKiqhH2cJS+AZJZOTVYPbBnDfuXaOV1xokX wWewitbiBeC3ec4kziuJFqia+dSDc4ql20gox4+Xreda8hxcUNylKCWP0/G4a3+llLBus Y5trQAhSudWoJca0MNRd6ZfpNwCqoB4PwbcBihtZwej7xYOjr1vSunIvs7pxpfqaHLQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass header.d=bytedance.com header.i=@bytedance.com header.a=rsa-sha256 header.s=2212171451 header.b=ctYu7bEg; arc=none smtp.remote-ip=209.127.230.115 Received: from va-1-115.ptr.blmpb.com (va-1-115.ptr.blmpb.com [209.127.230.115]) (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 957EC606A322 for ; Thu, 3 Dec 2026 12:59:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 957EC606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=bytedance.com header.i=@bytedance.com header.a=rsa-sha256 header.s=2212171451 header.b=ctYu7bEg DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1796302776; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=LHMNIz/t7bygstMV8D+rco5YlmKtWdqsIaZdNlttzf4=; b=ctYu7bEgaKcBHAk2fkoC9gFwmghtq5EpGN2KLQTibLV355cZ9nyGzICUVXIDFZtzqO+VtZ KFa7n3VSuPoMTMXMZ9FviJJXC8n3A7R/8UzEgDG3MsnqyQipa52l+3HsI4Ai103EtrwAnV CCW8ZOVAg0O5ONSgcNGA9UHC5m8ZQ8fY9ruljrD770o6z5PW3IPJ1hgh2B/Y62aHY25Em5 D39NJbFotovAisVaDIagkVe2yPwk13nI1zLly4eZRFgWraisoRm64VXpLX2JEh1PPzMKrJ IExtSWRHWX5dfkyd2MMf+MWl6/iehDHxFi2QLAaOsojKa4aufvobH3HjMwX3Yw== Subject: Re: [PATCH 1/2] cgroup/cpuset: Skip v2 sibling checks with an empty exclusive CPU mask 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-Type: text/plain; charset=UTF-8 User-Agent: Mozilla Thunderbird Cc: From: "Chuyi Zhou" X-Original-From: Chuyi Zhou X-Lms-Return-Path: References: Content-Transfer-Encoding: quoted-printable To: "Ridong Chen" , , , , Date: Thu, 3 Dec 2026 20:59:20 +0800 Message-Id: <1f3280f8-e2e5-4668-8db2-11c9579c4ab7@bytedance.com> In-Reply-To: On 2026-12-03 8:54 p.m., Ridong Chen wrote: >=20 >=20 > On 12/2/2026 6:44 PM, Chuyi Zhou wrote: >> validate_change() skips the sibling walk on v2 only for members whose >> exclusive CPU mask stays empty. It still scans siblings when a partition >> root has no explicit exclusive CPUs or when a cpuset clears its mask. >> >> An empty exclusive CPU mask can neither intersect a sibling's exclusive >> CPUs nor contain a sibling's nonempty allowed CPU mask. Only the top >> cpuset is memory-exclusive on v2, and it has no siblings. >> >> Skip the walk whenever the trial exclusive CPU mask is empty. For a >> partition root, compute_trialcs_excpus() still accounts for CPUs held >> by siblings when computing the effective exclusive mask. >> >> Suggested-by: Ridong Chen >> Link: https://lore.kernel.org/=20 >> r/825c0c94-8565-4c4c-82c7-9c0f5872e6a9@linux.dev >> Signed-off-by: Chuyi Zhou >> --- >> =C2=A0 kernel/cgroup/cpuset.c | 8 +++----- >> =C2=A0 1 file changed, 3 insertions(+), 5 deletions(-) >> >> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c >> index fb6359d72b68..d2337f817568 100644 >> --- a/kernel/cgroup/cpuset.c >> +++ b/kernel/cgroup/cpuset.c >> @@ -805,14 +805,11 @@ int validate_change(struct cpuset *cur, struct=20 >> cpuset *trial) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 !cpuset_cpumask_c= an_shrink(cur->effective_cpus,=20 >> user_xcpus(trial))) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto out; >> -=C2=A0=C2=A0=C2=A0 xcpus_changed =3D !cpumask_equal(cur->exclusive_cpus= , trial-=20 >> >exclusive_cpus); >> - >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* >> -=C2=A0=C2=A0=C2=A0=C2=A0 * On v2 an unchanged, empty exclusive CPU mask= cannot conflict with >> +=C2=A0=C2=A0=C2=A0=C2=A0 * On v2 an empty exclusive CPU mask cannot con= flict with >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * a sibling's CPU masks. Only the t= op cpuset is memory-exclusive. >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 */ >> -=C2=A0=C2=A0=C2=A0 if (cpuset_v2() && cs_is_member(cur) && !xcpus_chang= ed && >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cpumask_empty(trial->exclusi= ve_cpus)) >> +=C2=A0=C2=A0=C2=A0 if (cpuset_v2() && cpumask_empty(trial->exclusive_cp= us)) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto valid; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* >> @@ -820,6 +817,7 @@ int validate_change(struct cpuset *cur, struct=20 >> cpuset *trial) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * overlap. exclusive_cpus cannot ov= erlap with each other if set. >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 */ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ret =3D -EINVAL; >> +=C2=A0=C2=A0=C2=A0 xcpus_changed =3D !cpumask_equal(cur->exclusive_cpus= , trial-=20 >> >exclusive_cpus); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cpuset_for_each_child(c, css, par) { >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (c =3D=3D cur) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 continue; >=20 > Hi Chuyi, >=20 > Thank you for patches. >=20 > I don't think this should be a separate patch. I know Tejun has > already accepted patch 4 of your previous series, but if he can > update or drop it, a cleaner way would be to do patch 2 of this > series first, and then filter out the cpumask_empty(trial->exclusive_cpus= ) > case on top of it. That would make the changes easier to follow. >=20 Thanks for the suggestion. I agree that splitting the v1 and v2 checks=20 first would make the empty-mask case easier to follow. Tejun, would you be willing to drop patch 4 of the previous series? If=20 so, I'll rebase on top of patch 3 and send the split first, followed by=20 the v2 empty-mask check. Thanks.