aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRik van Riel <riel@redhat.com>2014-05-15 13:03:06 -0400
committerIngo Molnar <mingo@kernel.org>2014-05-22 05:16:39 -0400
commitb1ad065e65f56103db8b97edbd218a271ff5b1bb (patch)
treea44ca4ffbfc2fcc618ac668daffda4ef57f4988e
parente63da03639cc9e6e83b62e7ef8ffdbb92421416a (diff)
sched/numa: Update migrate_improves/degrades_locality()
Update the migrate_improves/degrades_locality() functions with knowledge of pseudo-interleaving. Do not consider moving tasks around within the set of group's active nodes as improving or degrading locality. Instead, leave the load balancer free to balance the load between a numa_group's active nodes. Also, switch from the group/task_weight functions to the group/task_fault functions. The "weight" functions involve a division, but both calls use the same divisor, so there's no point in doing that from these functions. On a 4 node (x10 core) system, performance of SPECjbb2005 seems unaffected, though the number of migrations with 2 8-warehouse wide instances seems to have almost halved, due to the scheduler running each instance on a single node. Signed-off-by: Rik van Riel <riel@redhat.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Cc: mgorman@suse.de Cc: chegu_vinod@hp.com Link: http://lkml.kernel.org/r/20140515130306.61aae7db@cuia.bos.redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--kernel/sched/fair.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index b899613f2bc6..503f750c2d25 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5123,6 +5123,7 @@ task_hot(struct task_struct *p, u64 now)
5123/* Returns true if the destination node has incurred more faults */ 5123/* Returns true if the destination node has incurred more faults */
5124static bool migrate_improves_locality(struct task_struct *p, struct lb_env *env) 5124static bool migrate_improves_locality(struct task_struct *p, struct lb_env *env)
5125{ 5125{
5126 struct numa_group *numa_group = rcu_dereference(p->numa_group);
5126 int src_nid, dst_nid; 5127 int src_nid, dst_nid;
5127 5128
5128 if (!sched_feat(NUMA_FAVOUR_HIGHER) || !p->numa_faults_memory || 5129 if (!sched_feat(NUMA_FAVOUR_HIGHER) || !p->numa_faults_memory ||
@@ -5136,21 +5137,29 @@ static bool migrate_improves_locality(struct task_struct *p, struct lb_env *env)
5136 if (src_nid == dst_nid) 5137 if (src_nid == dst_nid)
5137 return false; 5138 return false;
5138 5139
5139 /* Always encourage migration to the preferred node. */ 5140 if (numa_group) {
5140 if (dst_nid == p->numa_preferred_nid) 5141 /* Task is already in the group's interleave set. */
5141 return true; 5142 if (node_isset(src_nid, numa_group->active_nodes))
5143 return false;
5144
5145 /* Task is moving into the group's interleave set. */
5146 if (node_isset(dst_nid, numa_group->active_nodes))
5147 return true;
5142 5148
5143 /* If both task and group weight improve, this move is a winner. */ 5149 return group_faults(p, dst_nid) > group_faults(p, src_nid);
5144 if (task_weight(p, dst_nid) > task_weight(p, src_nid) && 5150 }
5145 group_weight(p, dst_nid) > group_weight(p, src_nid)) 5151
5152 /* Encourage migration to the preferred node. */
5153 if (dst_nid == p->numa_preferred_nid)
5146 return true; 5154 return true;
5147 5155
5148 return false; 5156 return task_faults(p, dst_nid) > task_faults(p, src_nid);
5149} 5157}
5150 5158
5151 5159
5152static bool migrate_degrades_locality(struct task_struct *p, struct lb_env *env) 5160static bool migrate_degrades_locality(struct task_struct *p, struct lb_env *env)
5153{ 5161{
5162 struct numa_group *numa_group = rcu_dereference(p->numa_group);
5154 int src_nid, dst_nid; 5163 int src_nid, dst_nid;
5155 5164
5156 if (!sched_feat(NUMA) || !sched_feat(NUMA_RESIST_LOWER)) 5165 if (!sched_feat(NUMA) || !sched_feat(NUMA_RESIST_LOWER))
@@ -5165,16 +5174,23 @@ static bool migrate_degrades_locality(struct task_struct *p, struct lb_env *env)
5165 if (src_nid == dst_nid) 5174 if (src_nid == dst_nid)
5166 return false; 5175 return false;
5167 5176
5177 if (numa_group) {
5178 /* Task is moving within/into the group's interleave set. */
5179 if (node_isset(dst_nid, numa_group->active_nodes))
5180 return false;
5181
5182 /* Task is moving out of the group's interleave set. */
5183 if (node_isset(src_nid, numa_group->active_nodes))
5184 return true;
5185
5186 return group_faults(p, dst_nid) < group_faults(p, src_nid);
5187 }
5188
5168 /* Migrating away from the preferred node is always bad. */ 5189 /* Migrating away from the preferred node is always bad. */
5169 if (src_nid == p->numa_preferred_nid) 5190 if (src_nid == p->numa_preferred_nid)
5170 return true; 5191 return true;
5171 5192
5172 /* If either task or group weight get worse, don't do it. */ 5193 return task_faults(p, dst_nid) < task_faults(p, src_nid);
5173 if (task_weight(p, dst_nid) < task_weight(p, src_nid) ||
5174 group_weight(p, dst_nid) < group_weight(p, src_nid))
5175 return true;
5176
5177 return false;
5178} 5194}
5179 5195
5180#else 5196#else