From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FD263BC667 for ; Thu, 30 Apr 2026 21:39:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777585150; cv=none; b=MqI+2BtRuri8OxXTogGZp2vROFg+2qKl1TYk5cpvqdf6H5VRVC1y1r/ZhLBhziwINo6p9W9seWqwwtR3B/s9OOceIyNUNyHvxXBJBs7a8AvmGlohiFGFNYm7r7FFcN08ADW9GCqh1Iq+B2/fHZfn5OMO4eCbJG3IdzXW6Y15+ms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777585150; c=relaxed/simple; bh=Q8E4LQU9WF0TNjpC1AeTgF6W4hffmiY+OeQ6uTIvkVk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h8JMWftHyu3FxXcB22G3oX7S2ijjBHTr24YZsJ2fAndB8n1o+xhPScmB/T9MUaN1S38z9yOgbYbCB+ElFuUaWoKfdkkOWhqPIMSBPA6bS/y9kRNdtm0gFTj3BuI207RHWSfCla+453WKMV2cVA+P8oD89wky8JPwXLZqIT8W2bU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QzPVb7M0; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QzPVb7M0" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-43cfd832155so898489f8f.1 for ; Thu, 30 Apr 2026 14:39:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777585146; x=1778189946; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JWoGjxjzkw/wpq4Ddv+4Pduxthdyfg2ZTCSp2ydxTBs=; b=QzPVb7M0ahMRtFGPcn7MaYsIZJmYZw2leBbae+T7rr708bWBEd7Xyn1OD9L1sXSsBJ 86cEH5PPhArnTUfZnep1C3eu9AYWdfMAAkB3m/TdJhAhYxBi7mQ+0FfJ5FrP2e25AU2F knqV75unleIB66W5BrrJ7hyduqbIiUsrYKvFGDDtK6M9pMfC5SYO9xHqKua8l33F+O6k 2RfNQglZauObKs9Um9MJ8xmtH38W9l1oereOv+JGfyWy/m7+ycf39LQs8CVqVQooiwz7 lgsV9a3dsOyZ4ON5jyO01jg3phe9ancwMHfBZ+Fz4KXrbVRu9f6GJ4EPRWQ7yTJh9WAY faRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777585146; x=1778189946; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=JWoGjxjzkw/wpq4Ddv+4Pduxthdyfg2ZTCSp2ydxTBs=; b=NVXlij/njlU1i9zd76oZr9fD5B3vIAc4nI1IrziZBBQX4vpTwu5ngKolQGgzL2R+zV PVZv7BiLUPUKa3wq0bMB9ucsmse/ODxciUBfaQ5cBmiPXLRVBCIpb1KpsMpM4EkT57/Z I/MyAaZSAoBNy9YiPD8Fis3ODXRKt2IcqE98Nf7Okxz+pYkT6cFxeMvA8gjejZuZ7kd2 Lto9RN/BqutlMDzjX+/41pPjowY58K1C4R+xRk66ovFJfz146ivfmg8HAoEqex7y9xsl qtMjNnhUpTjUsPYEjDJBIko7KK18VaKRJxmmHMCSu7bZ0Sn97GxUGENa0SBrqQfxB74X vGBg== X-Gm-Message-State: AOJu0YyMsoVDCCFJePs7ge1QAqLIgFR7E6USnJ3DPPlEgshYizEMs3c7 5tuyUVJfkse99/xaoUmAM8XTJtCKIEE2j3WxMOIr95Z8PMyEKtXa5API X-Gm-Gg: AeBDievAKepfkFuRWqEd7quJJpN82Rdtxnbc3Ldudjtu62pwWPKg3EBUNckEklWXh6N CXKUPEVg6hmHZKwAhZN0OGelxjh3MNP6AjH3Nm6e8XaZo2N5vMrxMMu4GluVTyx6HY4DiusPZR5 9kpE5mZQQ7Z0KeKUY0t5peHcj84IquVTaLE6qeS35GKiZD7hsiyKQWpypkHornPldCLO0rcpq33 WlkLqL3XweyBgZRxqtcLBKS2Tb0Gx7BJQARM243EizwcbZJRqz45Wm+jOGetsZbMKiH4wzSN7DD FgTZRFyX9tBg8cz9xiaDIMQMG4lj6d25n2z0mFRDxegi4uETeQWbt9OGEh/pRC/0F1Y0qf9ggl1 Lj5m6mzfr5Y6Qee0L5I0UNOi2RdZeqyFoyDw/BsOOf2+L286KUaDbwSHzCBjmnNhfq9Jt9JoSBU ChOfZONeA4IqJ7bF3E1UzrRPzQIGqhepTH5N5+RSMC X-Received: by 2002:a5d:64c6:0:b0:43d:6fce:3ef with SMTP id ffacd0b85a97d-4493e2ba8d4mr7506357f8f.21.1777585146293; Thu, 30 Apr 2026 14:39:06 -0700 (PDT) Received: from yuri-framework13 ([78.211.51.156]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-44a9879ef89sm418510f8f.30.2026.04.30.14.39.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 14:39:05 -0700 (PDT) From: Yuri Andriaccio To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider Cc: linux-kernel@vger.kernel.org, Luca Abeni , Yuri Andriaccio Subject: [RFC PATCH v5 16/29] sched/rt: Allow zeroing the runtime of the root control group Date: Thu, 30 Apr 2026 23:38:20 +0200 Message-ID: <20260430213835.62217-17-yurand2000@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260430213835.62217-1-yurand2000@gmail.com> References: <20260430213835.62217-1-yurand2000@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Allow execution of FIFO/RR tasks in the root cgroup regardless of reserved bandwidth. Tasks in the root cgroup use the standard FIFO/RR scheduler. Allow creation of cgroups with runtime or period zero. Disallow execution of tasks in zero bandwidth cgroups. --- In HCBS, the root control group follows the already existing rules for rt-task scheduling. As such, it does not make use of the deadline servers to account for runtime, or any other HCBS specific code and features. While the runtime of SCHED_DEADLINE tasks depends on the global bandwidth reserved for rt_tasks, the runtime of SCHED_FIFO/SCHED_RR tasks is limited by the activation of fair-servers (as the RT_THROTTLING mechanism has been removed in favour of them), thus their maximum bandwidth depends solely on the fair-server settings (which are thightly related to the global bandwidth reserved for rt-tasks) and the amount of SCHED_OTHER workload to run (recall that if no SCHED_OTHER tasks are running, the FIFO/RR tasks may fully utilize the CPU). The values of runtime and period in the root cgroup's cpu controller do not affect, by design of HCBS, the fair-server settings and similar (consequently they do not affect the scheduling of FIFO/RR tasks in the root cgroup), but they are just used to reserve a portion of the SCHED_DEADLINE bandwidth to the scheduling of rt-cgroups. These values only affect child cgroups, their deadline servers and their assigned FIFO/RR tasks. Signed-off-by: Yuri Andriaccio --- kernel/sched/rt.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index c994447f5b1c..5caddc5c2876 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -2085,7 +2085,8 @@ static int tg_rt_schedulable(struct task_group *tg, void *data) /* * Ensure we don't starve existing RT tasks if runtime turns zero. */ - if (dl_bandwidth_enabled() && !runtime && tg_has_rt_tasks(tg)) + if (dl_bandwidth_enabled() && tg != &root_task_group && + !runtime && tg_has_rt_tasks(tg)) return -EBUSY; if (WARN_ON(!rt_group_sched_enabled() && tg != &root_task_group)) @@ -2153,13 +2154,6 @@ static int tg_set_rt_bandwidth(struct task_group *tg, static DEFINE_MUTEX(rt_constraints_mutex); int i, err = 0; - /* - * Disallowing the root group RT runtime is BAD, it would disallow the - * kernel creating (and or operating) RT threads. - */ - if (tg == &root_task_group && rt_runtime == 0) - return -EINVAL; - /* * Bound quota to defend quota against overflow during bandwidth shift. */ @@ -2242,6 +2236,10 @@ static int sched_rt_global_constraints(void) int sched_rt_can_attach(struct task_group *tg) { + /* Allow executing in the root cgroup regardless of allowed bandwidth */ + if (tg == &root_task_group) + return 1; + /* Don't accept real-time tasks when there is no way for them to run */ if (rt_group_sched_enabled() && tg->dl_bandwidth.dl_runtime == 0) return 0; -- 2.53.0