aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorMete Durlu <meted@linux.ibm.com>2024-08-12 13:39:35 +0200
committerVasily Gorbik <gor@linux.ibm.com>2024-08-29 22:56:35 +0200
commitc0d4ba054f6a32c5d0a6740d90c97f91faf73fd7 (patch)
tree5a577328f317b585542a5809f3d57a4941caf04d /arch
parent6843d6d97c03b8fa506d188a483bc494a6ac4c89 (diff)
s390/hiperdispatch: Add steal time averaging
The measurements done by hiperdispatch can have sudden spikes and dips during run time. To prevent these outliers effecting the decision making process and causing adjustment overhead, use weighted average of the steal time. Acked-by: Vasily Gorbik <gor@linux.ibm.com> Co-developed-by: Tobias Huschle <huschle@linux.ibm.com> Signed-off-by: Tobias Huschle <huschle@linux.ibm.com> Signed-off-by: Mete Durlu <meted@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/kernel/hiperdispatch.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/s390/kernel/hiperdispatch.c b/arch/s390/kernel/hiperdispatch.c
index 233872d59b76..ed5b2d7d11c4 100644
--- a/arch/s390/kernel/hiperdispatch.c
+++ b/arch/s390/kernel/hiperdispatch.c
@@ -56,6 +56,7 @@
#define HD_DELAY_FACTOR (4)
#define HD_DELAY_INTERVAL (HZ / 4)
#define HD_STEAL_THRESHOLD 30
+#define HD_STEAL_AVG_WEIGHT 16
static cpumask_t hd_vl_coremask; /* Mask containing all vertical low COREs */
static cpumask_t hd_vmvl_cpumask; /* Mask containing vertical medium and low CPUs */
@@ -136,6 +137,14 @@ int hd_enable_hiperdispatch(void)
return 1;
}
+static unsigned long hd_steal_avg(unsigned long new)
+{
+ static unsigned long steal;
+
+ steal = (steal * (HD_STEAL_AVG_WEIGHT - 1) + new) / HD_STEAL_AVG_WEIGHT;
+ return steal;
+}
+
static unsigned long hd_calculate_steal_percentage(void)
{
unsigned long time_delta, steal_delta, steal, percentage;
@@ -185,7 +194,7 @@ static void hd_capacity_work_fn(struct work_struct *work)
mutex_unlock(&smp_cpu_state_mutex);
return;
}
- steal_percentage = hd_calculate_steal_percentage();
+ steal_percentage = hd_steal_avg(hd_calculate_steal_percentage());
if (steal_percentage < HD_STEAL_THRESHOLD)
new_cores = hd_online_cores;
else