diff options
| author | Syed Rameez Mustafa <rameezmustafa@codeaurora.org> | 2017-05-09 14:18:08 -0700 |
|---|---|---|
| committer | Syed Rameez Mustafa <rameezmustafa@codeaurora.org> | 2017-05-09 14:18:08 -0700 |
| commit | 64510d4751ba20893eaa181adde328399e19d81d (patch) | |
| tree | 9f5b07ebd6f6bc20773bb4199fc7d994fcec56dc | |
| parent | 3d82d66409abb91539bcb9d1f343fcb9d583f2b4 (diff) | |
sched: Don't active migrate tasks to CPUs in the same cluster
At the tick the scheduler checks whether a running task needs to
be migrated for some reason. If the reason is to up or down migrate
a task, we should only kick active balance when select_best_cpu()
returns a CPU in the appropriate cluster. Active migrating a task
to another CPU in the same cluster is wasteful.
Change-Id: I2c899a9c2dfb8ec4f983d7e355f0960f88bd3b45
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
| -rw-r--r-- | kernel/sched/fair.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 4d96380b35e8..9abc3e65dbd9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3536,6 +3536,16 @@ kick_active_balance(struct rq *rq, struct task_struct *p, int new_cpu) static DEFINE_RAW_SPINLOCK(migration_lock); +static bool do_migration(int reason, int new_cpu, int cpu) +{ + if ((reason == UP_MIGRATION || reason == DOWN_MIGRATION) + && same_cluster(new_cpu, cpu)) + return false; + + /* Inter cluster high irqload migrations are OK */ + return new_cpu != cpu; +} + /* * Check if currently running task should be migrated to a better cpu. * @@ -3553,7 +3563,7 @@ void check_for_migration(struct rq *rq, struct task_struct *p) raw_spin_lock(&migration_lock); new_cpu = select_best_cpu(p, cpu, reason, 0); - if (new_cpu != cpu) { + if (do_migration(reason, new_cpu, cpu)) { active_balance = kick_active_balance(rq, p, new_cpu); if (active_balance) mark_reserved(new_cpu); |
