diff options
author | Mel Gorman <mgorman@suse.de> | 2013-10-07 06:29:01 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-10-09 06:40:27 -0400 |
commit | 7a0f308337d11fd5caa9f845c6d08cc5d6067988 (patch) | |
tree | 91203c3f68fcc5d6a63dc7403fe43b1cc0fc3955 /kernel/sched/fair.c | |
parent | 3a7053b3224f4a8b0e8184166190076593621617 (diff) |
sched/numa: Resist moving tasks towards nodes with fewer hinting faults
Just as "sched: Favour moving tasks towards the preferred node" favours
moving tasks towards nodes with a higher number of recorded NUMA hinting
faults, this patch resists moving tasks towards nodes with lower faults.
Signed-off-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1381141781-10992-24-git-send-email-mgorman@suse.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/fair.c')
-rw-r--r-- | kernel/sched/fair.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6ffddca687fe..89431248d33d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -4107,12 +4107,43 @@ static bool migrate_improves_locality(struct task_struct *p, struct lb_env *env) | |||
4107 | 4107 | ||
4108 | return false; | 4108 | return false; |
4109 | } | 4109 | } |
4110 | |||
4111 | |||
4112 | static bool migrate_degrades_locality(struct task_struct *p, struct lb_env *env) | ||
4113 | { | ||
4114 | int src_nid, dst_nid; | ||
4115 | |||
4116 | if (!sched_feat(NUMA) || !sched_feat(NUMA_RESIST_LOWER)) | ||
4117 | return false; | ||
4118 | |||
4119 | if (!p->numa_faults || !(env->sd->flags & SD_NUMA)) | ||
4120 | return false; | ||
4121 | |||
4122 | src_nid = cpu_to_node(env->src_cpu); | ||
4123 | dst_nid = cpu_to_node(env->dst_cpu); | ||
4124 | |||
4125 | if (src_nid == dst_nid || | ||
4126 | p->numa_migrate_seq >= sysctl_numa_balancing_settle_count) | ||
4127 | return false; | ||
4128 | |||
4129 | if (p->numa_faults[dst_nid] < p->numa_faults[src_nid]) | ||
4130 | return true; | ||
4131 | |||
4132 | return false; | ||
4133 | } | ||
4134 | |||
4110 | #else | 4135 | #else |
4111 | static inline bool migrate_improves_locality(struct task_struct *p, | 4136 | static inline bool migrate_improves_locality(struct task_struct *p, |
4112 | struct lb_env *env) | 4137 | struct lb_env *env) |
4113 | { | 4138 | { |
4114 | return false; | 4139 | return false; |
4115 | } | 4140 | } |
4141 | |||
4142 | static inline bool migrate_degrades_locality(struct task_struct *p, | ||
4143 | struct lb_env *env) | ||
4144 | { | ||
4145 | return false; | ||
4146 | } | ||
4116 | #endif | 4147 | #endif |
4117 | 4148 | ||
4118 | /* | 4149 | /* |
@@ -4177,6 +4208,8 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env) | |||
4177 | * 3) too many balance attempts have failed. | 4208 | * 3) too many balance attempts have failed. |
4178 | */ | 4209 | */ |
4179 | tsk_cache_hot = task_hot(p, rq_clock_task(env->src_rq), env->sd); | 4210 | tsk_cache_hot = task_hot(p, rq_clock_task(env->src_rq), env->sd); |
4211 | if (!tsk_cache_hot) | ||
4212 | tsk_cache_hot = migrate_degrades_locality(p, env); | ||
4180 | 4213 | ||
4181 | if (migrate_improves_locality(p, env)) { | 4214 | if (migrate_improves_locality(p, env)) { |
4182 | #ifdef CONFIG_SCHEDSTATS | 4215 | #ifdef CONFIG_SCHEDSTATS |