From nobody Mon Dec 1 22:02:16 2025 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (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 95D5930C37D for ; Mon, 1 Dec 2025 12:42:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764592941; cv=none; b=S8/RlKRnIlAAoZx/h/pp9yV0W9N3zNraEl6NpkENND7ATGqrDknZQGMl1u9JfU7G7yVo1HPU5L0oOwMjCLVQe3WAGr0z+9/BrV65xGd9AA0tuAuZ2XraqYehcPEz6UjbUwK1hvx/w/nkx9A3SiKutpFkUPPx5buX1sno5S5mq6k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764592941; c=relaxed/simple; bh=oI7Z2jgP+psbwMMvyJAHJRLGccfzMoF+ggwgRyx44zM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H+an/GIFPz9vED4I2N+D/w5nDag0zZV/nlmICYXFousJU43C9KQS3ext8OiXulyN8KPckLnE4gsLaMZExDipPEjwt+sMJ14tyzt9JuACDu1+5LAualyZp3m9yaQndoOrN6msFd9iXi/PHC7cEMenDVpElpzIWlOuliGdivI3g/Y= 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=fMqkDt8O; arc=none smtp.client-ip=209.85.218.48 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="fMqkDt8O" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-b7291af7190so652573866b.3 for ; Mon, 01 Dec 2025 04:42:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764592938; x=1765197738; 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=5QdJ43HNE6kz3Z9ogRwg7j6TKHxVoh152ftOQ0IpmLE=; b=fMqkDt8OjZfyydsYbM1USGQIMdqg+VFjWhiLCGlBn2tbKirHcznAfSemHR/atcvG82 s7iuxug9WnPi1EWSXUb36OC+Y2a0EMzH/al6/d8B8fBWR3rK+arIqa52SWdrIOasKrpS WSmFd0F7KRzbJTRDZ6+sn+2l5ENFyr+EjSBnXydhkGS5D+rFaXfLOEvyAp6INVCCkOZf ymnzJoxgeAwHlGbAl7Ahce5ZmG/ixLdu8ewTD45pGnqBqthbn7/4tOzYzNi9rqacTB8t rcZ1GXGsfW6atmx9vzMAhdx9VCg6XLdCjedplhsHC7b5gghbK1l+2/7ThDe8LBEsduTj E1hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764592938; x=1765197738; 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=5QdJ43HNE6kz3Z9ogRwg7j6TKHxVoh152ftOQ0IpmLE=; b=HDxCp6swR3hEWx3K9tAPhgrNqfznneAiOjkEmP3huWpnHv+rnYPYd2AQZFtEwXMzuP cLbehOAchJ4j6oNzZA/Db9Mq2XSmWuCia1tBU4vkSrYlklRCSR43bX61o8Bz6jS8Ks0x OjQnKU7jH6wss911cnGLjuJXI1uw59PDrsz+EQZck2Ex8ltnVF9imQungj+20eFn61yT C7JEGS+nyRJlEL+cUxNfi/GDHEVrrFOfCl9Y+zI3nEqyK5DDxpnDcc0zRd1/AJ3IZ4Mc /RHMaAiL8QhI6YfHuzkqhPj3f8vCkCVF9p0kZ/OWSN6acP6zgG+CdTzQMm/UsndDzAw+ mSMQ== X-Gm-Message-State: AOJu0Yxrjt5K+uDLp6Q4YMqS43rLGX7MuKJ2pLL3JvTf24DV2YfhQmJB BDjkjCWXV3eeZu5H48X6etBu9n/0IeNmG6+gRKroyhHT8r2aL5/JB2uS X-Gm-Gg: ASbGncuSo1PVeVQpSSSQxP7rJ8VjuB3EfO+gMij+h19cWguRHo2vDeTbgVhMOpYCvpb XSLSzd35EFAiJyRI4E08ib6fVpQAOh2QCwHWD6VSVqGgg5yJVdQPHlJYyoKHqtFsycNm/Xu0mBQ OsXMtdcFjydbFZELVi/hGaL8zIkLTxMBHeL2R9TEzrmgKUy7T20L6NkRen0eVuZNfvooN5En+5U ihzAJAy1K3r9ZUAr7WMxiIOkzHneLG058EhQ3Ad21joIJOsi9oJqkx1oahkpcy8l5gc1T4ZCEp8 Hv3ti0I2UmI5u+PiyXLol7O1dPloRsYUvgPkQ4drG19DDleEQzUP+vFmiiSfN6FnkEEkfY8z+pS U6xifYS/ikUPApUhrICPbGsvlSZzKw5FU0Fo8G1GzRav3noy1/Ya61xhf0/6Xt/fub8YArUh3W7 tlPmHoLzQp X-Google-Smtp-Source: AGHT+IEVpk9DL6TxkXebttdCeVrtf5oJ8gsJabYJxnIs5bCdglkZBLjaxpgaQH+NNFkzvgAntlLgJQ== X-Received: by 2002:a17:906:fd8a:b0:b73:70db:4994 with SMTP id a640c23a62f3a-b76716954e5mr3957474466b.34.1764592937469; Mon, 01 Dec 2025 04:42:17 -0800 (PST) Received: from victus-lab ([193.205.81.5]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b76f59e8612sm1173738266b.52.2025.12.01.04.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Dec 2025 04:42:17 -0800 (PST) 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 v4 11/28] sched/deadline: Account rt-cgroups bandwidth in deadline tasks schedulability tests. Date: Mon, 1 Dec 2025 13:41:44 +0100 Message-ID: <20251201124205.11169-12-yurand2000@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251201124205.11169-1-yurand2000@gmail.com> References: <20251201124205.11169-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: quoted-printable Content-Type: text/plain; charset="utf-8" From: luca abeni Account the rt-cgroups hierarchy's reserved bandwidth in the schedulability test of deadline entities. This mechanism allows to completely reserve portion of the rt-bandwidth to rt-cgroups even if they do not use all of it. Account for the rt-cgroups' reserved bandwidth also when changing the total dedicated bandwidth for real time tasks. Co-developed-by: Alessio Balsini Signed-off-by: Alessio Balsini Co-developed-by: Andrea Parri Signed-off-by: Andrea Parri Co-developed-by: Yuri Andriaccio Signed-off-by: Yuri Andriaccio Signed-off-by: luca abeni --- kernel/sched/deadline.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 4f43883a65..089fd2c9b7 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -213,8 +213,15 @@ void __dl_add(struct dl_bw *dl_b, u64 tsk_bw, int cpus) static inline bool __dl_overflow(struct dl_bw *dl_b, unsigned long cap, u64 old_bw, u64 new_b= w) { + u64 dl_groups_root =3D 0; + +#ifdef CONFIG_RT_GROUP_SCHED + dl_groups_root =3D to_ratio(root_task_group.dl_bandwidth.dl_period, + root_task_group.dl_bandwidth.dl_runtime); +#endif return dl_b->bw !=3D -1 && - cap_scale(dl_b->bw, cap) < dl_b->total_bw - old_bw + new_bw; + cap_scale(dl_b->bw, cap) < dl_b->total_bw - old_bw + new_bw + + cap_scale(dl_groups_root, cap); } static inline @@ -3147,10 +3154,16 @@ int sched_dl_global_validate(void) u64 period =3D global_rt_period(); u64 new_bw =3D to_ratio(period, runtime); u64 cookie =3D ++dl_cookie; + u64 dl_groups_root =3D 0; struct dl_bw *dl_b; - int cpu, cpus, ret =3D 0; + int cpu, cap, cpus, ret =3D 0; unsigned long flags; +#ifdef CONFIG_RT_GROUP_SCHED + dl_groups_root =3D to_ratio(root_task_group.dl_bandwidth.dl_period, + root_task_group.dl_bandwidth.dl_runtime); +#endif + /* * Here we want to check the bandwidth not being set to some * value smaller than the currently allocated bandwidth in @@ -3163,10 +3176,12 @@ int sched_dl_global_validate(void) goto next; dl_b =3D dl_bw_of(cpu); + cap =3D dl_bw_capacity(cpu); cpus =3D dl_bw_cpus(cpu); raw_spin_lock_irqsave(&dl_b->lock, flags); - if (new_bw * cpus < dl_b->total_bw) + if (new_bw * cpus < dl_b->total_bw + + cap_scale(dl_groups_root, cap)) ret =3D -EBUSY; raw_spin_unlock_irqrestore(&dl_b->lock, flags); -- 2.51.0