Skip to content

Commit c0d4ba0

Browse files
NickJackolsonVasily Gorbik
authored andcommitted
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 <[email protected]> Co-developed-by: Tobias Huschle <[email protected]> Signed-off-by: Tobias Huschle <[email protected]> Signed-off-by: Mete Durlu <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent 6843d6d commit c0d4ba0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

arch/s390/kernel/hiperdispatch.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#define HD_DELAY_FACTOR (4)
5757
#define HD_DELAY_INTERVAL (HZ / 4)
5858
#define HD_STEAL_THRESHOLD 30
59+
#define HD_STEAL_AVG_WEIGHT 16
5960

6061
static cpumask_t hd_vl_coremask; /* Mask containing all vertical low COREs */
6162
static cpumask_t hd_vmvl_cpumask; /* Mask containing vertical medium and low CPUs */
@@ -136,6 +137,14 @@ int hd_enable_hiperdispatch(void)
136137
return 1;
137138
}
138139

140+
static unsigned long hd_steal_avg(unsigned long new)
141+
{
142+
static unsigned long steal;
143+
144+
steal = (steal * (HD_STEAL_AVG_WEIGHT - 1) + new) / HD_STEAL_AVG_WEIGHT;
145+
return steal;
146+
}
147+
139148
static unsigned long hd_calculate_steal_percentage(void)
140149
{
141150
unsigned long time_delta, steal_delta, steal, percentage;
@@ -185,7 +194,7 @@ static void hd_capacity_work_fn(struct work_struct *work)
185194
mutex_unlock(&smp_cpu_state_mutex);
186195
return;
187196
}
188-
steal_percentage = hd_calculate_steal_percentage();
197+
steal_percentage = hd_steal_avg(hd_calculate_steal_percentage());
189198
if (steal_percentage < HD_STEAL_THRESHOLD)
190199
new_cores = hd_online_cores;
191200
else

0 commit comments

Comments
 (0)