mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched/rt: Rebuild domains only after successful RT sysctl writes
@ 2026-03-13 18:37 Joseph Salisbury
  2026-09-23 17:20 ` Chengfeng Lin
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Salisbury @ 2026-03-13 18:37 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
  Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, linux-kernel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-23 17:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-13 18:37 [PATCH] sched/rt: Rebuild domains only after successful RT sysctl writes Joseph Salisbury
2026-09-23 17:20 ` Chengfeng Lin

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®