Skip to content

Commit

Permalink
sched/numa: Rework best node setting in task_numa_migrate()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rik van Riel authored and Ingo Molnar committed Jul 5, 2014
1 parent 0132c3e commit db015da
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -1354,10 +1354,6 @@ static int task_numa_migrate(struct task_struct *p)
}
}

/* No better CPU than the current one was found. */
if (env.best_cpu == -1)
return -EAGAIN;

/*
* If the task is part of a workload that spans multiple NUMA nodes,
* and is migrating into one of the workload's active nodes, remember
Expand All @@ -1366,8 +1362,19 @@ static int task_numa_migrate(struct task_struct *p)
* A task that migrated to a second choice node will be better off
* trying for a better one later. Do not set the preferred node here.
*/
if (p->numa_group && node_isset(env.dst_nid, p->numa_group->active_nodes))
sched_setnuma(p, env.dst_nid);
if (p->numa_group) {
if (env.best_cpu == -1)
nid = env.src_nid;
else
nid = env.dst_nid;

if (node_isset(nid, p->numa_group->active_nodes))
sched_setnuma(p, env.dst_nid);
}

/* No better CPU than the current one was found. */
if (env.best_cpu == -1)
return -EAGAIN;

/*
* Reset the scan period if the task is being rescheduled on an
Expand Down

0 comments on commit db015da

Please sign in to comment.