mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrea Righi <arighi@nvidia.com>
To: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	Tejun Heo <tj@kernel.org>,
	Patrick Bellasi <patrick.bellasi@arm.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] sched/deadline: Skip bandwidth accounting with SCHED_FLAG_KEEP_PARAMS
Date: Thu, 30 Jul 2026 07:56:31 +0200	[thread overview]
Message-ID: <20260730055631.2271580-1-arighi@nvidia.com> (raw)
In-Reply-To: <20260730055011.2267333-1-arighi@nvidia.com>

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@nvidia.com>
---
 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


  parent reply	other threads:[~2026-07-30  5:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30  5:50 [PATCH 0/2] sched: Fix SCHED_FLAG_KEEP_PARAMS side effects Andrea Righi
2026-07-30  5:50 ` [PATCH 1/2] sched: Skip class callbacks with SCHED_FLAG_KEEP_PARAMS Andrea Righi
2026-07-30  7:29   ` K Prateek Nayak
2026-07-30  8:57     ` Andrea Righi
2026-07-30  9:57     ` Peter Zijlstra
2026-07-30 11:42       ` Andrea Righi
2026-07-30  5:56 ` Andrea Righi [this message]
2026-07-30 10:04   ` [PATCH 2/2] sched/deadline: Skip bandwidth accounting " Peter Zijlstra
2026-07-30  9:32 ` [PATCH 0/2] sched: Fix SCHED_FLAG_KEEP_PARAMS side effects Peter Zijlstra
2026-07-30  9:52   ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260730055631.2271580-1-arighi@nvidia.com \
    --to=arighi@nvidia.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=patrick.bellasi@arm.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®