From nobody Thu Apr 2 00:13:27 2026 Received: from canpmsgout08.his.huawei.com (canpmsgout08.his.huawei.com [113.46.200.223]) (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 D1361329C5F for ; Fri, 20 Mar 2026 01:56:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.223 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773971770; cv=none; b=SdFVtY8K3fhz3+n2dXgATSdrcsmISanfab3lWTX41hsBL/fKk66wbbeShqoiOSBmLgKldsSNHLDbsmxC368N4Ayo0RbM+x1zmDV8/09nTvxnLGbdao9Y2iIasgiqH8MAdt8AHWs28U7M5LjhJxCQNpxGy67U07wVyaFzctcXaho= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773971770; c=relaxed/simple; bh=JO1dh9YlPFTggrE6NDYHmwntPpocu0zTh91fp26NxxQ=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=B9oNGiqd+oQopaannY03+lkdjfevxqChP6zhrAemDLzpp9NUM7Lb6yXbWXKLxIDPLnRl6lCGcjZ6hVE44MDuqmucPgtvLCG6xFoJllV7xxLbDTYOHhP0nvhaVPHD8sAe4/mwy5Xcz8h2fyxj58XZIHgQ795rmWFDREM6cyALFPY= 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=1ipOVDOL; arc=none smtp.client-ip=113.46.200.223 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="1ipOVDOL" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=NGp3nZpqe5GZJxToWdWSdvsgSre9PAC3sTpsv+hNJXg=; b=1ipOVDOLfJA7hdsu5Ad0hVuCzsF1q0kf8yb1bIMLWBzLxgPAX3EwkUeey3FQxlSEo36H6L8oJ c59HSLNZAk1+Pk8Dit5mqKmXCgw7uGyv8cJ6dKP9UQ8ZS5iW0fBWEiGvyBp1GvX29w0ZKN8Ooar eTvjutujHNgP6/cRKItLO28= Received: from mail.maildlp.com (unknown [172.19.163.214]) by canpmsgout08.his.huawei.com (SkyGuard) with ESMTPS id 4fcQWk233lzmV6f; Fri, 20 Mar 2026 09:50:58 +0800 (CST) Received: from kwepemr500016.china.huawei.com (unknown [7.202.195.68]) by mail.maildlp.com (Postfix) with ESMTPS id CDB0640561; Fri, 20 Mar 2026 09:55:59 +0800 (CST) Received: from huawei.com (10.67.174.242) by kwepemr500016.china.huawei.com (7.202.195.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 20 Mar 2026 09:55:07 +0800 From: Chen Jinghuang To: , , , , CC: , , , , Subject: [RESEND] In cgroup v2, setting a smaller value for sched_rt_runtime_us fails. Date: Fri, 20 Mar 2026 01:34:19 +0000 Message-ID: <20260320013419.2493925-1-chenjinghuang2@huawei.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems500002.china.huawei.com (7.221.188.17) To kwepemr500016.china.huawei.com (7.202.195.68) For example: # cat /proc/sys/kernel/sched_rt_runtime_us 950000 # echo 940000 > /proc/sys/kernel/sched_rt_runtime_us -bash: echo: write error: Invalid argument This occurs because when the global RT quota is reduced while the root cgroup=E2=80=99s ratio remains unchanged, the root cgroup=E2=80=99s proport= ion ends up exceeding the global RT ratio. This is unreasonable: the root cgroup=E2=80= =99s ratio should be updated when the global RT ratio changes. This patch ensures the root cgroup=E2=80=99s RT quota is adjusted whenever = the global RT quota is modified. Signed-off-by: Chen Ridong Tested-by: Madadi Vineeth Reddy Reviewed-by: Chen Jinghuang --- kernel/sched/rt.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index f1867fe8e5c5..30770ba7be4e 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -2814,9 +2814,11 @@ long sched_group_rt_period(struct task_group *tg) static int sched_rt_global_constraints(void) { int ret =3D 0; + u64 period =3D global_rt_period(); + u64 runtime =3D global_rt_runtime(); =20 mutex_lock(&rt_constraints_mutex); - ret =3D __rt_schedulable(NULL, 0, 0); + ret =3D __rt_schedulable(&root_task_group, period, runtime); mutex_unlock(&rt_constraints_mutex); =20 return ret; @@ -2856,6 +2858,14 @@ static int sched_rt_global_validate(void) =20 static void sched_rt_do_global(void) { +#ifdef CONFIG_RT_GROUP_SCHED + if (!rt_group_sched_enabled()) + return; + + WARN_ON_ONCE(tg_set_rt_bandwidth(&root_task_group, + global_rt_period(), + global_rt_runtime())); +#endif } =20 static int sched_rt_handler(const struct ctl_table *table, int write, void= *buffer, --=20 2.34.1