From nobody Sat Feb 7 06:20:36 2026 Received: from canpmsgout09.his.huawei.com (canpmsgout09.his.huawei.com [113.46.200.224]) (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 E90E636E472 for ; Thu, 5 Feb 2026 12:48:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.224 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770295708; cv=none; b=uCvipjmBb/uS4N+On73FkDMrqEbGcSJ1eyUnuUTHHG5fQyATSrsS7JmaUobuhkc/fkC69SVKKlvUZdhnKPukPOnVRx8muDcby2B/GRkwHpUS4VVMoDYd2rEpopsSbOBVXX70szUscpZ1Lol99+EWn+Os9OzIGr/jWw7irxM5pvM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770295708; c=relaxed/simple; bh=Q6fuDK0P+N81TkjipX0GoT44QBRWhR49PbTr1JHPkRY=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=ukdXrWYtN4aM2GOpzVUrA+H9iFlcJgAhjSX2fcjBE4ZWtLj7rPPNw6Dim1wVNTpN/EYLiAkF1OAFtxXeuWBV0r6f7UfOrMpkijYvSnGLJPHzlbW6wgUCkR6Qea+QbxEDM69PBXV7/6d1DwUOXk582hmskRbD4OVC0c+Usmc7p3M= 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=OTIQ0wJE; arc=none smtp.client-ip=113.46.200.224 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="OTIQ0wJE" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=/G0zPQ+Ha/eVnvh4a1jDNVdVKvblA2MfX3viyYbYik4=; b=OTIQ0wJEpwVo3fnwFAMk1JBgkhYWktAy4Ej1w98ZLPb1x7Z4eZEAWxTdI7v6OhWvqKBMPAoZ4 J7jMP1cTrkeMhOkFvbaYWj6SflkhrdKovKvrUgzZ9qDUDYoRLdr458vaSynEJPDzuwLHhGwnBGK Qsf+QMssBbM3JPvAHolAv38= Received: from mail.maildlp.com (unknown [172.19.162.92]) by canpmsgout09.his.huawei.com (SkyGuard) with ESMTPS id 4f6H2s328cz1cyPL; Thu, 5 Feb 2026 20:43:49 +0800 (CST) Received: from kwepemr500016.china.huawei.com (unknown [7.202.195.68]) by mail.maildlp.com (Postfix) with ESMTPS id EF4D340565; Thu, 5 Feb 2026 20:48:23 +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; Thu, 5 Feb 2026 20:48:23 +0800 From: Chen Jinghuang To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot CC: Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Subject: [PATCH] In cgroup v2, setting a smaller value for sched_rt_runtime_us fails. Date: Thu, 5 Feb 2026 12:27:58 +0000 Message-ID: <20260205122758.1855422-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: kwepems200001.china.huawei.com (7.221.188.67) 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 Signed-off-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