From nobody Tue Apr 7 14:05:58 2026 Received: from canpmsgout11.his.huawei.com (canpmsgout11.his.huawei.com [113.46.200.226]) (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 4B73B26FD97 for ; Thu, 26 Feb 2026 03:59:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772078349; cv=none; b=j88d1akKIBY5zQNbmHsOZRz46nUpbrMupmpyrDw564HQv09mnpEKB9x66aPnhSc5XfhWqyQed7SB+0TX9zX4hSRGNos9Ii40Hr8Q8hTsBjWH5Lfk3cdcS1feetsjd0VxBXc/uAVJuqWTfMhYfctO6nDbarqxhKQqAS4gGdE0FFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772078349; c=relaxed/simple; bh=Q6fuDK0P+N81TkjipX0GoT44QBRWhR49PbTr1JHPkRY=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=YFzqeyXx5kuxUZWGsFNlpVotQzaMbGL5sgv/Zv+MTndOHr4y1TQ0b2NAXFefxOSrerajGq/eW4JMFfaaWLUdonB1/EzsFrhe/y86aUn2UJURYp1zRHYghjlxc4+w0o/64iKltWUn6mVUlbZs3R9gay97M6akFeNHbdjdJ51hsFo= 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.226 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.163.163]) by canpmsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4fLyJ15rNzzKm5y; Thu, 26 Feb 2026 11:54:09 +0800 (CST) Received: from kwepemr500016.china.huawei.com (unknown [7.202.195.68]) by mail.maildlp.com (Postfix) with ESMTPS id B9CB040565; Thu, 26 Feb 2026 11:58:57 +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, 26 Feb 2026 11:58:57 +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: [RESEND] In cgroup v2, setting a smaller value for sched_rt_runtime_us fails. Date: Thu, 26 Feb 2026 03:38:39 +0000 Message-ID: <20260226033839.129431-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: kwepems100001.china.huawei.com (7.221.188.238) 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 Reviewed-by: Chen Ridong --- 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