diff options
author | Rik van Riel <riel@redhat.com> | 2014-06-23 11:41:34 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-07-05 05:17:39 -0400 |
commit | db015daedb56251b73f956f70b3b8813f80d8ee1 (patch) | |
tree | 9883ace8d1f2edf4ae39a5f3348eea5e7c96f336 /kernel/sched | |
parent | 0132c3e1777ceabc24c7d209b7cbe78c28c03c09 (diff) |
sched/numa: Rework best node setting in task_numa_migrate()
Fix up the best node setting in task_numa_migrate() to deal with a task
in a pseudo-interleaved NUMA group, which is already running in the
best location.
Set the task's preferred nid to the current nid, so task migration is
not retried at a high rate.
Signed-off-by: Rik van Riel <riel@redhat.com>
Cc: mgorman@suse.de
Cc: chegu_vinod@hp.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1403538095-31256-7-git-send-email-riel@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/fair.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 9d1734a724a8..7bb2f464b456 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -1354,10 +1354,6 @@ static int task_numa_migrate(struct task_struct *p) | |||
1354 | } | 1354 | } |
1355 | } | 1355 | } |
1356 | 1356 | ||
1357 | /* No better CPU than the current one was found. */ | ||
1358 | if (env.best_cpu == -1) | ||
1359 | return -EAGAIN; | ||
1360 | |||
1361 | /* | 1357 | /* |
1362 | * If the task is part of a workload that spans multiple NUMA nodes, | 1358 | * If the task is part of a workload that spans multiple NUMA nodes, |
1363 | * and is migrating into one of the workload's active nodes, remember | 1359 | * and is migrating into one of the workload's active nodes, remember |
@@ -1366,8 +1362,19 @@ static int task_numa_migrate(struct task_struct *p) | |||
1366 | * A task that migrated to a second choice node will be better off | 1362 | * A task that migrated to a second choice node will be better off |
1367 | * trying for a better one later. Do not set the preferred node here. | 1363 | * trying for a better one later. Do not set the preferred node here. |
1368 | */ | 1364 | */ |
1369 | if (p->numa_group && node_isset(env.dst_nid, p->numa_group->active_nodes)) | 1365 | if (p->numa_group) { |
1370 | sched_setnuma(p, env.dst_nid); | 1366 | if (env.best_cpu == -1) |
1367 | nid = env.src_nid; | ||
1368 | else | ||
1369 | nid = env.dst_nid; | ||
1370 | |||
1371 | if (node_isset(nid, p->numa_group->active_nodes)) | ||
1372 | sched_setnuma(p, env.dst_nid); | ||
1373 | } | ||
1374 | |||
1375 | /* No better CPU than the current one was found. */ | ||
1376 | if (env.best_cpu == -1) | ||
1377 | return -EAGAIN; | ||
1371 | 1378 | ||
1372 | /* | 1379 | /* |
1373 | * Reset the scan period if the task is being rescheduled on an | 1380 | * Reset the scan period if the task is being rescheduled on an |