blob: 7e5771b86f5246feab5844ca5fd96f9377776787 [file] [log] [blame] [edit]
From 01a8bb220e19eda997f2cba4ee04d1db0df3758d Mon Sep 17 00:00:00 2001
From: Joel Fernandes <joelaf@google.com>
Date: Mon, 2 Oct 2023 16:50:34 +0000
Subject: [PATCH] CHROMIUM: sched/fair: Make minimum load balance interval a
tunable
We are seeing a several fold reduction in number of SCHED_SOFTIRQ by
tuning the minimum interval of periodic load balance to a higher value.
This could also result in higher power savings, lower CPU usage and
lesser system overhead. Make it a tunable so that it is easier for
userspace to experiment, such as via finch on ChromeOS.
While this effects both high and low resolution timers, this will bring
down the recent increase in softirqs seen in low resolution timers as
well. There are other patches also that fix the increase in softirq
specifically for low resolution timers.
BUG=b:263289152
UPSTREAM-TASK=b:303083202
Co-developed-by: Vineeth Pillai <vineethrp@google.com>
Change-Id: I5041e0a01bd11e617d59d8f8d23c2f59d5772f47
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4908115
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
---
kernel/sched/fair.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 6092b13e9a0f8c9dcb0a4f78a7c198870ac08d2f..07a5fb5e3dbc9adc8be4db47f925c25b3c5709c5 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -86,6 +86,12 @@ unsigned int sysctl_sched_child_runs_first __read_mostly;
const_debug unsigned int sysctl_sched_migration_cost = 500000UL;
+/*
+ * The minimum load balance interval in jiffies that must pass before a
+ * a periodic or nohz-idle balance happens.
+ */
+static unsigned long __read_mostly sysctl_sched_min_load_balance_interval = 1UL;
+
int sched_thermal_decay_shift;
static int __init setup_sched_thermal_decay_shift(char *str)
{
@@ -172,6 +178,13 @@ static struct ctl_table sched_fair_sysctls[] = {
.extra1 = SYSCTL_ZERO,
},
#endif /* CONFIG_NUMA_BALANCING */
+ {
+ .procname = "sched_min_load_balance_interval",
+ .data = &sysctl_sched_min_load_balance_interval,
+ .maxlen = sizeof(unsigned long),
+ .mode = 0644,
+ .proc_handler = proc_doulongvec_minmax,
+ },
{}
};
@@ -9342,7 +9355,8 @@ void update_group_capacity(struct sched_domain *sd, int cpu)
unsigned long interval;
interval = msecs_to_jiffies(sd->balance_interval);
- interval = clamp(interval, 1UL, max_load_balance_interval);
+ interval = clamp(interval, sysctl_sched_min_load_balance_interval,
+ max_load_balance_interval);
sdg->sgc->next_update = jiffies + interval;
if (!child) {
--
2.42.0.655.g421f12c284-goog