mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joseph Salisbury <joseph.salisbury@oracle.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>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] sched/rt: Rebuild domains only after successful RT sysctl writes
Date: Fri, 13 Mar 2026 14:37:16 -0400	[thread overview]
Message-ID: <20260313183716.990792-1-joseph.salisbury@oracle.com> (raw)

sched_rt_handler() unconditionally calls rebuild_sched_domains() on exit.

That means scheduler domains are rebuilt even for read-only sysctl access,
and also after writes that fail validation and roll back to the old RT
bandwidth values.

Track whether the write path completed validation and global RT/DL updates,
and rebuild scheduler domains only in that case.

Fixes: 440989c10f4e ("sched/deadline: Fix accounting after global limits change")
Cc: stable@vger.kernel.org
Signed-off-by: Joseph Salisbury <joseph.salisbury@oracle.com>
---
 kernel/sched/rt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 906f6c656c2e..ada9249b22cd 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2871,6 +2871,7 @@ static int sched_rt_handler(const struct ctl_table *table, int write, void *buff
 {
 	int old_period, old_runtime;
 	static DEFINE_MUTEX(mutex);
+	bool rebuild = false;
 	int ret;
 
 	mutex_lock(&mutex);
@@ -2895,6 +2896,7 @@ static int sched_rt_handler(const struct ctl_table *table, int write, void *buff
 
 		sched_rt_do_global();
 		sched_dl_do_global();
+		rebuild = true;
 	}
 	if (0) {
 undo:
@@ -2908,7 +2910,8 @@ static int sched_rt_handler(const struct ctl_table *table, int write, void *buff
 	 * After changing maximum available bandwidth for DEADLINE, we need to
 	 * recompute per root domain and per cpus variables accordingly.
 	 */
-	rebuild_sched_domains();
+	if (rebuild)
+		rebuild_sched_domains();
 
 	return ret;
 }
-- 
2.47.3

             reply	other threads:[~2026-03-13 18:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 18:37 Joseph Salisbury [this message]
2026-09-23 17:20 ` Chengfeng Lin

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=20260313183716.990792-1-joseph.salisbury@oracle.com \
    --to=joseph.salisbury@oracle.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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®