[PATCH 2/2] sched/deadline: Skip bandwidth accounting with SCHED_FLAG_KEEP_PARAMS
From: Andrea Righi
Date: Thu Jul 30 2026 - 01:58:21 EST
A sched_setattr() invocation targeting a non-deadline task can specify
SCHED_DEADLINE together with SCHED_FLAG_KEEP_PARAMS. The flag prevents
__sched_setscheduler() from applying the requested parameters or class,
but deadline admission runs before the guarded update and immediately
accounts the requested bandwidth in the root domain. Repeating the
invocation can therefore consume bandwidth without creating a deadline
task capable of releasing it.
Skip deadline bandwidth admission when SCHED_FLAG_KEEP_PARAMS is set,
since neither the deadline policy nor its parameters will change.
Fixes: a509a7cd7974 ("sched/uclamp: Extend sched_setattr() to support utilization clamping")
Signed-off-by: Andrea Righi <arighi@xxxxxxxxxx>
---
kernel/sched/syscalls.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/syscalls.c b/kernel/sched/syscalls.c
index 903b47f5d0b74..e95ed51110fbd 100644
--- a/kernel/sched/syscalls.c
+++ b/kernel/sched/syscalls.c
@@ -650,7 +650,8 @@ int __sched_setscheduler(struct task_struct *p,
* of a SCHED_DEADLINE task) we need to check if enough bandwidth
* is available.
*/
- if ((dl_policy(policy) || dl_task(p)) && sched_dl_overflow(p, policy, attr)) {
+ if (!(attr->sched_flags & SCHED_FLAG_KEEP_PARAMS) &&
+ (dl_policy(policy) || dl_task(p)) && sched_dl_overflow(p, policy, attr)) {
retval = -EBUSY;
goto unlock;
}
--
2.55.0