From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout03.his.huawei.com (canpmsgout03.his.huawei.com [113.46.200.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E0763590C3 for ; Mon, 2 Feb 2026 11:39:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770032361; cv=none; b=QK2Q9joWFgD6lcT0r+SaF6RSWqH+buwh7w9bEboxtBkJ0CKlwgHBVIBvZ58ChFmwwfJVi5E/5xDuWnXaGXFkQH6Ioa+Q4U793eEWuU6E6ekXlIaIEI7SmMGkfTtZa9dNYWzeENROS/3pumxk3yMiwWQwHjKdlvJKb0Jw4NSjvkk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770032361; c=relaxed/simple; bh=fwxaJsaGWNowhagetR23xNYsz33iRQAiRJ+dc8ZuAus=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=LEA2hGzo4q1VIxUipboYoc02IE96q1rYWwk3grTQFVcArykCBy9GlMX2bw1EeHU5wTneUsMfDwtAs93FkAyVQluqiCu4y7H48QPF/uImNfi0bBwUZrPFy8mlBV5hwe0+yTSv48KmTABRfb0RL15obA5O5yWs9OoXjO6mcduR+oE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=10Xf9MyM; arc=none smtp.client-ip=113.46.200.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="10Xf9MyM" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=NxhQgt40ThAInsCKLSNV3vVVwbVeIHzCq7dnfNOzkQc=; b=10Xf9MyMP6bwfL/XFBuMnHREc6VJQqBtP7aaUqDkpreqjuaFxPGVmKE96ZyjRLlZjBou0F8k7 izcwnmg7mGEkvfM/3aOqwvCGEo7w2Awr2tqA1b7P2f0s1N9kiReYGfRTxL73Ox/of5Qg7F7X5lM HSO0kbqFZe0iAe1iMyc7pt8= Received: from mail.maildlp.com (unknown [172.19.162.197]) by canpmsgout03.his.huawei.com (SkyGuard) with ESMTPS id 4f4Pg0182gzpSwH; Mon, 2 Feb 2026 19:35:08 +0800 (CST) Received: from kwepemg500008.china.huawei.com (unknown [7.202.181.45]) by mail.maildlp.com (Postfix) with ESMTPS id 6714F40363; Mon, 2 Feb 2026 19:39:15 +0800 (CST) Received: from kwepemg100008.china.huawei.com (7.202.181.26) by kwepemg500008.china.huawei.com (7.202.181.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 2 Feb 2026 19:39:15 +0800 Received: from kwepemg100008.china.huawei.com ([7.202.181.26]) by kwepemg100008.china.huawei.com ([7.202.181.26]) with mapi id 15.02.1544.036; Mon, 2 Feb 2026 19:39:15 +0800 From: chenjinghuang To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot CC: Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , "linux-kernel@vger.kernel.org" Subject: [Question] sched_rt_runtime_us adjustment differs between cgroup v1 and v2 (EINVAL issue) Thread-Topic: [Question] sched_rt_runtime_us adjustment differs between cgroup v1 and v2 (EINVAL issue) Thread-Index: AdyUOF/wix3eTIVTTs2VJxzOQb3Udg== Date: Mon, 2 Feb 2026 11:39:14 +0000 Message-ID: <6403a98a2fe44bd18231a5ab2519f477@huawei.com> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 I hope this email finds you well. I'm reaching out to clarify a behavioral = difference between cgroup v1 and v2 when adjusting the global sched_rt_runt= ime_us sysctl parameter, which I've encountered during testing. Below is a = detailed description of the issue and my core question: 1. Background & Problem Phenomenon The default value of /proc/sys/kernel/sched_rt_runtime_us is 950000 us (0.9= 5s). When I attempt to lower this value (e.g., `echo 940000 > /proc/sys/ker= nel/sched_rt_runtime_us`) in a cgroup v2-only environment, the operation fa= ils with "Invalid argument" (EINVAL). By tracing the kernel code, I found the failure originates from the tg_rt_s= chedulable() function, where the following check enforces that the total RT= runtime of all task groups (tg->rt_bandwidth.rt_runtime) cannot exceed the= global sched_rt_runtime_us: /* * Nobody can have more than the global setting allows. */=20 if (total > to_ratio(global_rt_period(), global_rt_runtime()))=20 return -EINVAL; 2. Key Difference Between cgroup v1 and v2 cgroup v1: I can work around this restriction by first modifying /sys/fs/cg= roup/cpu/cpu.rt_runtime_us (the user-space interface for tg->rt_bandwidth.r= t_runtime), lowering the root cgroup's RT runtime (e.g., to 940000 us). Aft= er this adjustment, setting sched_rt_runtime_us to 940000us succeeds without EINVAL. cgroup v2: The cpu.rt_runtime_us interface is no longer available. As a res= ult, there is no way to lower the root cgroup's tg->rt_bandwidth.rt_runtime= first, which blocks any attempt to set sched_rt_runtime_us to a value belo= w 950000 us. 3. Core question Can you explain the design considerations behind this behavioral difference= between cgroup v1 and v2 ? Specially: 1. Why was the direct adjustment of tg->rt_bandwidth.rt_runtime (via cpu.rt= _runtime_us) removed in cgroup v2 ? 2. Is there an correct way to lower the global sched_rt_runtime_us in cgrou= p v2? I appreciate any insights or guidance you can provide. Thank you for your t= ime and help! =20