Revert 095bebf61a
("sched/numa: Do not move past the balance point if unbalanced")
Commit095bebf61a
("sched/numa: Do not move past the balance point if unbalanced") broke convergence of workloads with just one runnable thread, by making it impossible for the one runnable thread on the system to move from one NUMA node to another. Instead, the thread would remain where it was, and pull all the memory across to its location, which is much slower than just migrating the thread to where the memory is. The next patch has a better fix for the issue that095bebf61a
tried to address. Reported-by: Jirka Hladky <jhladky@redhat.com> Signed-off-by: Rik van Riel <riel@redhat.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: dedekind1@gmail.com Cc: mgorman@suse.de Link: http://lkml.kernel.org/r/1432753468-7785-2-git-send-email-riel@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
54d27365ca
commit
e4991b240c
1 changed files with 15 additions and 26 deletions
|
@ -1198,11 +1198,9 @@ static void task_numa_assign(struct task_numa_env *env,
|
||||||
static bool load_too_imbalanced(long src_load, long dst_load,
|
static bool load_too_imbalanced(long src_load, long dst_load,
|
||||||
struct task_numa_env *env)
|
struct task_numa_env *env)
|
||||||
{
|
{
|
||||||
|
long imb, old_imb;
|
||||||
|
long orig_src_load, orig_dst_load;
|
||||||
long src_capacity, dst_capacity;
|
long src_capacity, dst_capacity;
|
||||||
long orig_src_load;
|
|
||||||
long load_a, load_b;
|
|
||||||
long moved_load;
|
|
||||||
long imb;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The load is corrected for the CPU capacity available on each node.
|
* The load is corrected for the CPU capacity available on each node.
|
||||||
|
@ -1215,39 +1213,30 @@ static bool load_too_imbalanced(long src_load, long dst_load,
|
||||||
dst_capacity = env->dst_stats.compute_capacity;
|
dst_capacity = env->dst_stats.compute_capacity;
|
||||||
|
|
||||||
/* We care about the slope of the imbalance, not the direction. */
|
/* We care about the slope of the imbalance, not the direction. */
|
||||||
load_a = dst_load;
|
if (dst_load < src_load)
|
||||||
load_b = src_load;
|
swap(dst_load, src_load);
|
||||||
if (load_a < load_b)
|
|
||||||
swap(load_a, load_b);
|
|
||||||
|
|
||||||
/* Is the difference below the threshold? */
|
/* Is the difference below the threshold? */
|
||||||
imb = load_a * src_capacity * 100 -
|
imb = dst_load * src_capacity * 100 -
|
||||||
load_b * dst_capacity * env->imbalance_pct;
|
src_load * dst_capacity * env->imbalance_pct;
|
||||||
if (imb <= 0)
|
if (imb <= 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The imbalance is above the allowed threshold.
|
* The imbalance is above the allowed threshold.
|
||||||
* Allow a move that brings us closer to a balanced situation,
|
* Compare it with the old imbalance.
|
||||||
* without moving things past the point of balance.
|
|
||||||
*/
|
*/
|
||||||
orig_src_load = env->src_stats.load;
|
orig_src_load = env->src_stats.load;
|
||||||
|
orig_dst_load = env->dst_stats.load;
|
||||||
|
|
||||||
/*
|
if (orig_dst_load < orig_src_load)
|
||||||
* In a task swap, there will be one load moving from src to dst,
|
swap(orig_dst_load, orig_src_load);
|
||||||
* and another moving back. This is the net sum of both moves.
|
|
||||||
* A simple task move will always have a positive value.
|
|
||||||
* Allow the move if it brings the system closer to a balanced
|
|
||||||
* situation, without crossing over the balance point.
|
|
||||||
*/
|
|
||||||
moved_load = orig_src_load - src_load;
|
|
||||||
|
|
||||||
if (moved_load > 0)
|
old_imb = orig_dst_load * src_capacity * 100 -
|
||||||
/* Moving src -> dst. Did we overshoot balance? */
|
orig_src_load * dst_capacity * env->imbalance_pct;
|
||||||
return src_load * dst_capacity < dst_load * src_capacity;
|
|
||||||
else
|
/* Would this change make things worse? */
|
||||||
/* Moving dst -> src. Did we overshoot balance? */
|
return (imb > old_imb);
|
||||||
return dst_load * src_capacity < src_load * dst_capacity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue