From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.127.230.111 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796208311; b=jb+NlYE67IjM0dy2TCsMAFXAne6paKX8gd2b6E4pkZOT9eoTzPJi7t0enL+p6FqZjbTM 86iJXAun4V2HUInKpD/568ZvK0jgp5uH5LYoOcMgSXX9nlfd9c195JhhdoGgGGNHGlLSr 7zBAQyNks8sGAhPYl+3DflPwIsbQ9/8kvdhk0VYT6EZ/RllYaGPbPu4J3+54i5LTnE7ng rbLxWU5I+4s18Fvni2QFp1nT4nR+zjJa8yjku9BDw4YFmGFSekAcbhhcWVxBBSXEeZpDW B6zUwRft9RdRzPv0PlFtz0DMhH/1C3ZdfmIK5rnqlVgQ7jE+3IxC1eY5NZ2tA9nW5Tw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796208311; h=DMARC-Filter:DKIM-Signature:To:Message-Id:X-Lms-Return-Path:From: Subject:X-Mailer:Content-Type:Date:Mime-Version: Content-Transfer-Encoding:References:X-Original-From:Cc:In-Reply-To; bh=pfU9Va/FbCUrG4anMWXDek4dxXlZcbc6zeW0/3pJkWw=; b=HGQxxfwpVHFS79gLtRun0n+8qQ9b3K/5kSyPbgznWZgwi/Fo4Yh8CV2fj/TuzrrWwawX Meoq1oyPg5UPIw+MCkkmPQxaMwAEMK+HbkEgmKeNzEACwfo1DmmIUwnPxIV8vJb7285TR thANfFPq63nzn3Gd95+zYDsjkp7z/VIYEFV+htx20cSjv72wBUQH8dguvUJaoUPcRl0LO yWiKqm0qJ9zH5X8e6pI+YwoVK2m5MXqshvaRn74+Sn6H2yevJRu8MF7903IsDVSt4HsDW mHFhLEfT0P+G+/QAI22Yvg6d4XWWiYAsjN0EUT35eKZRK4qk9sAVpAJpdf/sN0K3bPg== 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=KbttDpTM; arc=none smtp.remote-ip=209.127.230.111 Received: from va-1-111.ptr.blmpb.com (va-1-111.ptr.blmpb.com [209.127.230.111]) (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 3D424606A335 for ; Wed, 2 Dec 2026 10:45:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3D424606A335 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) header.d=bytedance.com header.i=@bytedance.com header.a=rsa-sha256 header.s=2212171451 header.b=KbttDpTM DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1796208303; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=pfU9Va/FbCUrG4anMWXDek4dxXlZcbc6zeW0/3pJkWw=; b=KbttDpTMl9CiZJaJxetNeLsE5fsM0FrNiZiQVED3AvXxpup+SRewS3pjX1SvE2KKqYRUGx rJ+UOx3rn7MYKXf/ExdBwpV47Kz8Q241qSfWJ92n4I4Udgz9dwINC6iikgB9PQfFD+amBU +rodQa8FHgvgObOJQ8C1duKHeXcKrQvfPgnuJWAMnPrSAy6JOMhd1nGyXIzeiYA0nCrMHR bNWW8R2Yi+Q38vA4i+oGLurwV5lUi5UohLthzgPADyEVL3BXHGKL4MTykrMCd5BFzSC4gj mclX66aaHKnMzW5daCLeuEqnz+x0xPGCRUhwQxSdJJAOaLeB7+O+9idbYTjiIA== To: , , , , Message-Id: X-Lms-Return-Path: From: "Chuyi Zhou" Subject: [PATCH 1/2] cgroup/cpuset: Skip v2 sibling checks with an empty exclusive CPU mask X-Mailer: git-send-email 2.20.1 Content-Type: text/plain; charset=UTF-8 Date: Wed, 2 Dec 2026 18:44:20 +0800 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: 7bit References: X-Original-From: Chuyi Zhou Cc: , "Chuyi Zhou" In-Reply-To: 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/r/825c0c94-8565-4c4c-82c7-9c0f5872e6a9@linux.dev Signed-off-by: Chuyi Zhou --- kernel/cgroup/cpuset.c | 8 +++----- 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 cpuset *trial) !cpuset_cpumask_can_shrink(cur->effective_cpus, user_xcpus(trial))) goto out; - xcpus_changed = !cpumask_equal(cur->exclusive_cpus, trial->exclusive_cpus); - /* - * On v2 an unchanged, empty exclusive CPU mask cannot conflict with + * On v2 an empty exclusive CPU mask cannot conflict with * a sibling's CPU masks. Only the top cpuset is memory-exclusive. */ - if (cpuset_v2() && cs_is_member(cur) && !xcpus_changed && - cpumask_empty(trial->exclusive_cpus)) + if (cpuset_v2() && cpumask_empty(trial->exclusive_cpus)) goto valid; /* @@ -820,6 +817,7 @@ int validate_change(struct cpuset *cur, struct cpuset *trial) * overlap. exclusive_cpus cannot overlap with each other if set. */ ret = -EINVAL; + xcpus_changed = !cpumask_equal(cur->exclusive_cpus, trial->exclusive_cpus); cpuset_for_each_child(c, css, par) { if (c == cur) continue; -- 2.20.1