Mel Gorman 23bc96
From 4327b047a564129dbcbb0392ef62a4bafb5aa602 Mon Sep 17 00:00:00 2001
Mel Gorman 23bc96
From: Thomas Gleixner <tglx@linutronix.de>
Mel Gorman 23bc96
Date: Tue, 28 Sep 2021 14:24:25 +0200
Mel Gorman 23bc96
Subject: [PATCH] sched: Limit the number of task migrations per batch on RT
Mel Gorman 23bc96
Mel Gorman 23bc96
References: bsc#1189998 (PREEMPT_RT prerequisite backports)
Takashi Iwai 350551
Patch-mainline: v5.16-rc1
Mel Gorman 23bc96
Git-commit: 691925f3ddccea832cf2d162dc277d2623a816e3
Mel Gorman 23bc96
Mel Gorman 23bc96
Batched task migrations are a source for large latencies as they keep the
Mel Gorman 23bc96
scheduler from running while processing the migrations.
Mel Gorman 23bc96
Mel Gorman 23bc96
Limit the batch size to 8 instead of 32 when running on a RT enabled
Mel Gorman 23bc96
kernel.
Mel Gorman 23bc96
Mel Gorman 23bc96
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Mel Gorman 23bc96
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Mel Gorman 23bc96
Link: https://lkml.kernel.org/r/20210928122411.425097596@linutronix.de
Mel Gorman 23bc96
Signed-off-by: Mel Gorman <mgorman@suse.de>
Mel Gorman 23bc96
---
Mel Gorman 23bc96
 kernel/sched/core.c | 4 ++++
Mel Gorman 23bc96
 1 file changed, 4 insertions(+)
Mel Gorman 23bc96
Mel Gorman 23bc96
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
Mel Gorman 23bc96
index d22489d3245a..6eb9def79dd5 100644
Mel Gorman 23bc96
--- a/kernel/sched/core.c
Mel Gorman 23bc96
+++ b/kernel/sched/core.c
Mel Gorman 23bc96
@@ -74,7 +74,11 @@ __read_mostly int sysctl_resched_latency_warn_once = 1;
Mel Gorman 23bc96
  * Number of tasks to iterate in a single balance run.
Mel Gorman 23bc96
  * Limited because this is done with IRQs disabled.
Mel Gorman 23bc96
  */
Mel Gorman 23bc96
+#ifdef CONFIG_PREEMPT_RT
Mel Gorman 23bc96
+const_debug unsigned int sysctl_sched_nr_migrate = 8;
Mel Gorman 23bc96
+#else
Mel Gorman 23bc96
 const_debug unsigned int sysctl_sched_nr_migrate = 32;
Mel Gorman 23bc96
+#endif
Mel Gorman 23bc96
 
Mel Gorman 23bc96
 /*
Mel Gorman 23bc96
  * period over which we measure -rt task CPU usage in us.