From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.127.230.113 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796040331; b=Z5kVHhYZl8y2nMiPf3jUJ27bgwDzUNFvlIuuQIbph9VUcvLJ/25cm3VLp2kzSNFLl+Xp BY8R9KGHlaZgCQhMOsNP9JoBp1Qpobvq16XFUgnKVRMu4FE6MRCWe3H9PG34n2RotgtO3 egr73yWYoRmY2b41AA5I5+hW06UmM35V03YnFwCDOK5gZWxTIoC9FCe3MJ5szEU80MT5K YjBr5vpzUIOjudYH7B8GxGkloNcuTVLatk2lMMHh3QTrzCp0FMpKgz0QcX5McckYq/2C4 jIKEkYMijaBJJWHl9QM7L/uq10DSpfOjj//0wdghUawqQlHAj/ifwGbPhtku09dWPqQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796040331; h=DMARC-Filter:DKIM-Signature:Cc:X-Original-From:Mime-Version: Content-Type:To:From:Date:Message-Id:Subject: Content-Transfer-Encoding:X-Lms-Return-Path:X-Mailer; bh=ML3zc8to2pG9ze4tqh9l3Hw+mJu/nae6GX9vy4iAbdo=; b=HrUZN0fZfK3a8uvIKJp6Ck5VJ2p0ENEWqO8OFGBoxgEcPoXnZGBIVh5JKrdvDY/pVl8w jrdgzvqlt2bcDRyc7DJzQZz+pLXN6mctj5EWvQyPDmaxCpG+i1sHs7fUoC/8ADmoXq4xF j0DhTqysWjmbcdlOvy29kWndquJLJlZwUbC3KO8b8ibisxUefErF5vYHrN/HQ5ueAEZXo INrPP+DFk5WgbeRFGXiEHxgLH7K0RB/JUTh/S8QXOyTmFvUsFv87Y6NqWTseK0xBMKWLF anEqjqHnCyAOUTiaunYtmdeKdrzHVltKNYdNGGAoG7DDWPYl6OTJRBCcrVmooIBy2FA== 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=QD2OofPw; arc=none smtp.remote-ip=209.127.230.113 Received: from va-1-113.ptr.blmpb.com (va-1-113.ptr.blmpb.com [209.127.230.113]) (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 624C3606A32C for ; Mon, 30 Nov 2026 12:05:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 624C3606A32C 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=QD2OofPw DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1796040324; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=ML3zc8to2pG9ze4tqh9l3Hw+mJu/nae6GX9vy4iAbdo=; b=QD2OofPwFqrX6AhAAonUjV++e3a9VEYD30mL/WgPea75k6lMSvDjTWePN7OBUmQkKc3LRZ /OSzo97PuJPrFXy1g9R+oNhtkzeHcxdnYYZ8aoUe1SE3PJobHiEbw6fGtST3XAN1NgFnsV PfXY5Ld9qu3AGGguYbfBpJanB9orS8jHCIi40HZN05Av/fgttbxzqXYd5Ij7RbdKwpeAQa CN5fYUBjF9yComLKKXAMJrbGAVPdED8qiHTuhg1YGTAMG8X15f3RVYyEIkv5pF4+djEFJO x0VT53/uSNnuE65WN1aM6EQc4KiGIIWIMAG4RhHArrt1YvMNf7aQdBk6CsKS9A== Cc: , "Chuyi Zhou" X-Original-From: Chuyi Zhou 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 To: , , , , From: "Chuyi Zhou" Date: Mon, 30 Nov 2026 20:04:47 +0800 Message-Id: Subject: [PATCH v2 0/4] cgroup/cpuset: Speed up v2 mask updates and domain rebuilds Content-Transfer-Encoding: 7bit X-Lms-Return-Path: X-Mailer: git-send-email 2.20.1 Changes in v2: - Rebase onto cgroup/for-7.5. - Patch 2: Name cpuset1_generate_sched_domains() as the remaining caller of cpusets_overlap() in the helper comment (Ridong). - New patch 3: Drop cpusets_overlap() and call cpumask_intersects() directly in cpuset1_generate_sched_domains() (Ridong). The sibling-scan optimization from v1 is now patch 4. - Add Ridong's Reviewed-by to patches 1 and 2. v1: https://lore.kernel.org/lkml/cover.1795436486.git.zhouchuyi@bytedance.com/ We run high-density container workloads on large bare-metal hosts using cgroup v2. We may configure many root partitions on a single host. We resize them at runtime based on each partition's CPU PSI. Changing a member's cpuset.cpus scans its siblings under cpuset_mutex, so the cost of a write grows with the number of children under the same parent. Creating or resizing a root partition can trigger a scheduling domain rebuild. The rebuild checks every pair of partition CPU masks for overlap, so the number of checks grows quadratically with the number of partitions. This series speeds up cpuset.cpus updates and scheduling domain rebuilds on these hosts. The timings below are from a dual-socket Xeon Platinum 8582C with 240 online CPUs. 1. All v2 partitions use the default scheduling domain attributes. Passing NULL saves one array allocation per rebuild and one attribute initialization per partition. 2. Check each partition's effective CPUs against the union of the masks already seen to detect overlap in a single pass. With 128 root partitions, median time in generate_sched_domains() fell from 42.9 us to 3.14 us. 3. Skip the sibling scan when a member's cpuset.cpus.exclusive stays empty. With 2,048 children under one parent and one sleeping task in the target cpuset, median write latency for cpuset.cpus fell from 24.1 us to 0.85 us. Thanks, Chuyi Chuyi Zhou (4): cgroup/cpuset: Skip the sched domain attribute allocation on v2 cgroup/cpuset: Check v2 partition overlap in a single pass cgroup/cpuset: Drop cpusets_overlap() cgroup/cpuset: Skip sibling checks for v2 members without exclusive CPUs kernel/cgroup/cpuset-internal.h | 9 ---- kernel/cgroup/cpuset-v1.c | 3 +- kernel/cgroup/cpuset.c | 74 +++++++++++++++++---------------- 3 files changed, 41 insertions(+), 45 deletions(-) base-commit: 3aeec6cbfda2c7e08ea465a346be28ee8d1fef58 -- 2.20.1