aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched
diff options
context:
space:
mode:
authorHillf Danton <dhillf@gmail.com>2014-06-10 04:58:43 -0400
committerIngo Molnar <mingo@kernel.org>2014-06-18 12:29:59 -0400
commit5d5e2b1bcbdc996e72815c03fdc5ea82c4642397 (patch)
treeca7417f06a98918e05142c9e52481e5eaea8d894 /kernel/sched
parentbb97fc31647539f1f102eed646a95e200160a150 (diff)
sched: Fix CACHE_HOT_BUDY condition
When computing cache hot, we should check if the migration dst cpu is idle, instead of the current cpu. Though they are same in normal balancing, that is false nowadays in nohz idle balancing at least. Signed-off-by: Hillf Danton <dhillf@gmail.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Cc: Hillf Danton <hillf.zj@alibaba-inc.com> Cc: Mike Galbraith <mgalbraith@suse.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: http://lkml.kernel.org/r/20140607090452.4696E301D2@webmail.sinamail.sina.com.cn Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/fair.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 3fa3e1839c86..1f9c4571615d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5095,8 +5095,7 @@ static void move_task(struct task_struct *p, struct lb_env *env)
5095/* 5095/*
5096 * Is this task likely cache-hot: 5096 * Is this task likely cache-hot:
5097 */ 5097 */
5098static int 5098static int task_hot(struct task_struct *p, struct lb_env *env)
5099task_hot(struct task_struct *p, u64 now)
5100{ 5099{
5101 s64 delta; 5100 s64 delta;
5102 5101
@@ -5109,7 +5108,7 @@ task_hot(struct task_struct *p, u64 now)
5109 /* 5108 /*
5110 * Buddy candidates are cache hot: 5109 * Buddy candidates are cache hot:
5111 */ 5110 */
5112 if (sched_feat(CACHE_HOT_BUDDY) && this_rq()->nr_running && 5111 if (sched_feat(CACHE_HOT_BUDDY) && env->dst_rq->nr_running &&
5113 (&p->se == cfs_rq_of(&p->se)->next || 5112 (&p->se == cfs_rq_of(&p->se)->next ||
5114 &p->se == cfs_rq_of(&p->se)->last)) 5113 &p->se == cfs_rq_of(&p->se)->last))
5115 return 1; 5114 return 1;
@@ -5119,7 +5118,7 @@ task_hot(struct task_struct *p, u64 now)
5119 if (sysctl_sched_migration_cost == 0) 5118 if (sysctl_sched_migration_cost == 0)
5120 return 0; 5119 return 0;
5121 5120
5122 delta = now - p->se.exec_start; 5121 delta = rq_clock_task(env->src_rq) - p->se.exec_start;
5123 5122
5124 return delta < (s64)sysctl_sched_migration_cost; 5123 return delta < (s64)sysctl_sched_migration_cost;
5125} 5124}
@@ -5273,7 +5272,7 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env)
5273 * 2) task is cache cold, or 5272 * 2) task is cache cold, or
5274 * 3) too many balance attempts have failed. 5273 * 3) too many balance attempts have failed.
5275 */ 5274 */
5276 tsk_cache_hot = task_hot(p, rq_clock_task(env->src_rq)); 5275 tsk_cache_hot = task_hot(p, env);
5277 if (!tsk_cache_hot) 5276 if (!tsk_cache_hot)
5278 tsk_cache_hot = migrate_degrades_locality(p, env); 5277 tsk_cache_hot = migrate_degrades_locality(p, env);
5279 5278