From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 06DE437BE84 for ; Mon, 8 Jun 2026 12:15:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780920961; cv=none; b=HA+bBu3PaE54iz3ySoewqWXoLzOFXCVrgdCfnuatml0C24f+hTDvdoyKhzstzL/Aat/iIiZzVe0vxOMvY7D6ZXBa2xy/1LmZ3KKPzQx8yjsB0EVPondxEsEfRrB4B3INC+sqF2H62rLc6plKfYrLz0TOksd5uCGTPpEXntNTtRU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780920961; c=relaxed/simple; bh=92fhzTOKe1eWv26TwL8Usa1oTklYxybytl7/TzxxfVM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i9MQTv6rxgeAwGwGpWyVt+2X0oyeVY+EfCAMNeKTypSf1E96bBFedh3kVOlGCuGw8J6jsMwCPuIKMLOZ7VZGMUO0AMLSrkUGlnQc7WYuUuQSbm4Y3nrr53BAUgDe2gwGxjN2xwJhPpCim+xlMRwnU7MjxU+pQTSUsY+wPnOxTEY= 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=dcvmsug9; arc=none smtp.client-ip=209.85.128.52 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="dcvmsug9" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-490b1bbcf3aso34444685e9.1 for ; Mon, 08 Jun 2026 05:15:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780920956; x=1781525756; 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=wdaPQPUNpe7pv5r2Wo/aUtFcdIVNOnNCTBCujeA0Bao=; b=dcvmsug9oKr93W+xdd9AGH2ornVuZNFyEy00eHvQkZ2qUGAEeBXObPdqc/yidDuLwN cqSPnF78WNYhbFcEK74l7U0U4mpOz3zRvd/bKMwYYdHTLlPQyMh3VrWGaTERl2b3i+zq 7kRB3NMKglszQbppIjqKNDO7niy22VDMxFsfWSA4ed9a6D802L+jkM6rz+8l83DHe3Pk 2Gwk+guH2VMsLd5Aa+8QliuEBYRfZlabM50C+aMaleiA3GmTi1+O+vOxSsT2WfxLa+kW E6fTLVhohq2QR9imyDskb0YRHvHPK3xh1P+fgUsHwGZ2ER+KHX5Xzo7N/WWgNvGS6ZxM r6Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780920956; x=1781525756; 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=wdaPQPUNpe7pv5r2Wo/aUtFcdIVNOnNCTBCujeA0Bao=; b=Qd3xQhHRLy1CtK2BXn1KKcgS/W5iujgzSIKY+iai7/84TWCocclyQ+0krfagXgFVg9 hzbMqmFDgnVdmQT6n0de7/mZrvaDc/cpQpMkR90hpzexyDq+9euqWWVWdbfulqylAnjV 8e0UPdlFG0iiP2WHMFxHNh1XZvKpWvi3IMe5X56TYZn6mJcmqTxhA6m0jTwwSbgRswyO IOAcw+BGAWrJQA8LJtiI/U1zmn6wjVdgVYT5sEzbTz64qWLCoauhkOUI2nWKGn1DrdMO ZPWM8GTGt68clRY4Izr6+y78pioIkqT52IQj85uDuhsK+TLVxVGqrqp9fi30E8RXSuhr 5vCg== X-Forwarded-Encrypted: i=1; AFNElJ/xcBm9SU3nNCLHrcYrRTsmHfrgBx2in+F1RUIvLxGUr7LXa9lNSprICNkiUlu1rNG7he7oQVnp4FrtIcE=@vger.kernel.org X-Gm-Message-State: AOJu0YwJ/SHi4XKhcMduVLcfQmlCCq9f5LS/ZCjIAIFjR+oxjDOY3PhK up7nq6b83hzH4nPpE1dX3+BKZBDtq3iUCoxJnyWMVHRfSnsRJUiD3IOf X-Gm-Gg: Acq92OEKAwxCRZTQtW44bSirdrBo/2/KuCSwDmDHqf3Sjbi6iQx7f7DOaf1n8sHjVkc HGoY2VMSJZLwUmdNclHktE8t+act1MylUGSLOWS6eNG8JJv9dIGVOxGBvl8rM1AIMT9mCUuBqpN D6ZTp7FOnHWfQbT49pvMVufhEpfUYSF8ImINh4WC1BQxdo/JA3ws6pwGU19qcyHOeHhzSFVxhr0 iH3dr2PM3NOYBA7EIl5BIbSgXAZWa+OqnKWkr0mX6Z5PebZlOtgPucrgKtkHby8cKa3yLjcMM3h UZbZWi+rHLqo05T0ryR2DhlWI9mgNg/gRbbhy7pA9QbnhePlnQtYsHoDK/3qHwpELcQkQqzL/ts gT0LLsjTirn3yie/coOxyz0MkWO9y+O90NQKALE+7mlXXHxiX52NJJsJVRKFdae+bxn4pOBL6MK nB6/ZX6331i41AJ/YH2P43lP0zTrtBIRQ= X-Received: by 2002:a05:600c:19d2:b0:490:47e3:929a with SMTP id 5b1f17b1804b1-490c25ada0dmr261074695e9.6.1780920956340; Mon, 08 Jun 2026 05:15:56 -0700 (PDT) Received: from victus-lab ([193.205.81.5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f2ec711sm50644906f8f.12.2026.06.08.05.15.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 05:15:55 -0700 (PDT) From: Yuri Andriaccio To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Tejun Heo , Johannes Weiner , =?UTF-8?q?Michal=20Koutn=C3=BD?= Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Abeni , Yuri Andriaccio Subject: [RFC PATCH v6 09/25] sched/rt: Introduce HCBS specific structs in task_group Date: Mon, 8 Jun 2026 14:15:28 +0200 Message-ID: <20260608121546.69910-10-yurand2000@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260608121546.69910-1-yurand2000@gmail.com> References: <20260608121546.69910-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 From: luca abeni Add an array of sched_dl_entity objects in task_group. Create the dl_bandwidth struct and add a field for it in task_group. Add a rq pointer field in struct rt_rq. --- For each CPU on the host system, the task_group manages a sched_dl_entity and a rt_rq object, which in turn keeps a pointer to its locally managed runqueue. The sched_dl_entity object manages the deadline server which will be scheduled for execution on the CPU, while the rt_rq object is instead used to reference the local runqueue's specific data and entities and it is used when an actual task must be scheduled when the CPU is given to the dl_server. The dl_bandwidth object keeps track of the currently allocated bandwidth for the cgroup and the currently active context. RT-cgroups can either run tasks themselves or can delegate the scheduling of their tasks to their parent, the active_context field keeps track of which cgroup is serving the 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/sched.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 3aa29fe932fc..f3c259ab9344 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -322,6 +322,15 @@ struct rt_bandwidth { unsigned int rt_period_active; }; +struct dl_bandwidth { + raw_spinlock_t dl_runtime_lock; + u64 dl_runtime; + u64 dl_internal_runtime; + u64 dl_period; + struct task_group *active_context; +}; + + static inline int dl_bandwidth_enabled(void) { return sysctl_sched_rt_runtime >= 0; @@ -495,10 +504,17 @@ struct task_group { #endif /* CONFIG_FAIR_GROUP_SCHED */ #ifdef CONFIG_RT_GROUP_SCHED + /* + * Each task group manages a different scheduling entity per CPU, i.e. a + * different deadline server, and a runqueue per CPU. All the dl-servers + * share the same dl_bandwidth object. + */ struct sched_rt_entity **rt_se; + struct sched_dl_entity **dl_se; struct rt_rq **rt_rq; struct rt_bandwidth rt_bandwidth; + struct dl_bandwidth dl_bandwidth; #endif struct scx_task_group scx; @@ -861,6 +877,12 @@ struct rt_rq { #ifdef CONFIG_CGROUP_SCHED struct task_group *tg; /* this tg has "this" rt_rq on given CPU for runnable entities */ #endif + + /* + * The cgroup's served runqueue if the rt_rq entity belongs to a cgroup, + * otherwise the top-level global runqueue. + */ + struct rq *rq; }; static inline bool rt_rq_is_runnable(struct rt_rq *rt_rq) -- 2.54.0