mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
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>
This commit is contained in:
parent
bb97fc3164
commit
5d5e2b1bcb
1 changed files with 4 additions and 5 deletions
|
@ -5095,8 +5095,7 @@ static void move_task(struct task_struct *p, struct lb_env *env)
|
||||||
/*
|
/*
|
||||||
* Is this task likely cache-hot:
|
* Is this task likely cache-hot:
|
||||||
*/
|
*/
|
||||||
static int
|
static int task_hot(struct task_struct *p, struct lb_env *env)
|
||||||
task_hot(struct task_struct *p, u64 now)
|
|
||||||
{
|
{
|
||||||
s64 delta;
|
s64 delta;
|
||||||
|
|
||||||
|
@ -5109,7 +5108,7 @@ task_hot(struct task_struct *p, u64 now)
|
||||||
/*
|
/*
|
||||||
* Buddy candidates are cache hot:
|
* Buddy candidates are cache hot:
|
||||||
*/
|
*/
|
||||||
if (sched_feat(CACHE_HOT_BUDDY) && this_rq()->nr_running &&
|
if (sched_feat(CACHE_HOT_BUDDY) && env->dst_rq->nr_running &&
|
||||||
(&p->se == cfs_rq_of(&p->se)->next ||
|
(&p->se == cfs_rq_of(&p->se)->next ||
|
||||||
&p->se == cfs_rq_of(&p->se)->last))
|
&p->se == cfs_rq_of(&p->se)->last))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -5119,7 +5118,7 @@ task_hot(struct task_struct *p, u64 now)
|
||||||
if (sysctl_sched_migration_cost == 0)
|
if (sysctl_sched_migration_cost == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
delta = now - p->se.exec_start;
|
delta = rq_clock_task(env->src_rq) - p->se.exec_start;
|
||||||
|
|
||||||
return delta < (s64)sysctl_sched_migration_cost;
|
return delta < (s64)sysctl_sched_migration_cost;
|
||||||
}
|
}
|
||||||
|
@ -5273,7 +5272,7 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env)
|
||||||
* 2) task is cache cold, or
|
* 2) task is cache cold, or
|
||||||
* 3) too many balance attempts have failed.
|
* 3) too many balance attempts have failed.
|
||||||
*/
|
*/
|
||||||
tsk_cache_hot = task_hot(p, rq_clock_task(env->src_rq));
|
tsk_cache_hot = task_hot(p, env);
|
||||||
if (!tsk_cache_hot)
|
if (!tsk_cache_hot)
|
||||||
tsk_cache_hot = migrate_degrades_locality(p, env);
|
tsk_cache_hot = migrate_degrades_locality(p, env);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue