summaryrefslogtreecommitdiff
path: root/kernel/sched/fair.c
diff options
context:
space:
mode:
authorPavankumar Kondeti <pkondeti@codeaurora.org>2015-04-10 15:10:56 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:01:59 -0700
commitc17d7d3c4033e4ccb1022930d88e655230dbc79b (patch)
treed73f1e13fd89be32c1ef67e186e2e3c2c9312efa /kernel/sched/fair.c
parent37921ca6be838402cbd6cb408a7a3f7aa5cea6f7 (diff)
sched: auto adjust the upmigrate and downmigrate thresholds
The load scale factor of a CPU gets boosted when its max freq is restricted. A task load at the same frequency is scaled higher than normal under this scenario. This results in tasks migrating early to the better capacity CPUs and their residency over there also gets increased as their inflated load would be relatively higher than than the downmigrate threshold. Auto adjust the upmigrate and downmigrate thresholds by a factor equal to rq->max_possible_freq/rq->max_freq of a lower capacity CPU. If the adjusted upmigrate threshold exceeds the window size, it is clipped to the window size. If the adjusted downmigrate threshold decreases the difference between the upmigrate and downmigrate, it is clipped to a value such that the difference between the modified and the original thresholds is same. Change-Id: Ifa70ee5d4ca5fe02789093c7f070c77629907f04 Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Diffstat (limited to 'kernel/sched/fair.c')
-rw-r--r--kernel/sched/fair.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 06639a3def40..85831d2f47ed 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2777,6 +2777,14 @@ static int __read_mostly sched_upmigrate_min_nice = 15;
int __read_mostly sysctl_sched_upmigrate_min_nice = 15;
/*
+ * The load scale factor of a CPU gets boosted when its max frequency
+ * is restricted due to which the tasks are migrating to higher capacity
+ * CPUs early. The sched_upmigrate threshold is auto-upgraded by
+ * rq->max_possible_freq/rq->max_freq of a lower capacity CPU.
+ */
+unsigned int up_down_migrate_scale_factor = 1024;
+
+/*
* Scheduler boost is a mechanism to temporarily place tasks on CPUs
* with higher capacity than those where a task would have normally
* ended up with their load characteristics. Any entity enabling
@@ -2791,6 +2799,35 @@ static inline int available_cpu_capacity(int cpu)
return rq->capacity;
}
+void update_up_down_migrate(void)
+{
+ unsigned int up_migrate = pct_to_real(sysctl_sched_upmigrate_pct);
+ unsigned int down_migrate = pct_to_real(sysctl_sched_downmigrate_pct);
+ unsigned int delta;
+
+ if (up_down_migrate_scale_factor == 1024)
+ goto done;
+
+ delta = up_migrate - down_migrate;
+
+ up_migrate /= NSEC_PER_USEC;
+ up_migrate *= up_down_migrate_scale_factor;
+ up_migrate >>= 10;
+ up_migrate *= NSEC_PER_USEC;
+
+ up_migrate = min(up_migrate, sched_ravg_window);
+
+ down_migrate /= NSEC_PER_USEC;
+ down_migrate *= up_down_migrate_scale_factor;
+ down_migrate >>= 10;
+ down_migrate *= NSEC_PER_USEC;
+
+ down_migrate = min(down_migrate, up_migrate - delta);
+done:
+ sched_upmigrate = up_migrate;
+ sched_downmigrate = down_migrate;
+}
+
void set_hmp_defaults(void)
{
sched_spill_load =
@@ -2799,11 +2836,7 @@ void set_hmp_defaults(void)
sched_small_task =
pct_to_real(sysctl_sched_small_task_pct);
- sched_upmigrate =
- pct_to_real(sysctl_sched_upmigrate_pct);
-
- sched_downmigrate =
- pct_to_real(sysctl_sched_downmigrate_pct);
+ update_up_down_migrate();
#ifdef CONFIG_SCHED_FREQ_INPUT
sched_heavy_task =