summaryrefslogtreecommitdiffstats
path: root/mm/mempolicy.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2013-10-07 06:29:20 -0400
committerIngo Molnar <mingo@kernel.org>2013-10-09 08:47:45 -0400
commit90572890d202527c366aa9489b32404e88a7c020 (patch)
tree0577f3b043e312f6d53e50105b236514f7df2455 /mm/mempolicy.c
parente1dda8a797b59d7ec4b17e393152ec3273a552d5 (diff)
mm: numa: Change page last {nid,pid} into {cpu,pid}
Change the per page last fault tracking to use cpu,pid instead of nid,pid. This will allow us to try and lookup the alternate task more easily. Note that even though it is the cpu that is store in the page flags that the mpol_misplaced decision is still based on the node. Signed-off-by: Peter Zijlstra <peterz@infradead.org> 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> Link: http://lkml.kernel.org/r/1381141781-10992-43-git-send-email-mgorman@suse.de [ Fixed build failure on 32-bit systems. ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r--mm/mempolicy.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 0e895a2eed5f..a5867ef24bda 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2324,6 +2324,8 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
2324 struct zone *zone; 2324 struct zone *zone;
2325 int curnid = page_to_nid(page); 2325 int curnid = page_to_nid(page);
2326 unsigned long pgoff; 2326 unsigned long pgoff;
2327 int thiscpu = raw_smp_processor_id();
2328 int thisnid = cpu_to_node(thiscpu);
2327 int polnid = -1; 2329 int polnid = -1;
2328 int ret = -1; 2330 int ret = -1;
2329 2331
@@ -2372,11 +2374,11 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
2372 2374
2373 /* Migrate the page towards the node whose CPU is referencing it */ 2375 /* Migrate the page towards the node whose CPU is referencing it */
2374 if (pol->flags & MPOL_F_MORON) { 2376 if (pol->flags & MPOL_F_MORON) {
2375 int last_nidpid; 2377 int last_cpupid;
2376 int this_nidpid; 2378 int this_cpupid;
2377 2379
2378 polnid = numa_node_id(); 2380 polnid = thisnid;
2379 this_nidpid = nid_pid_to_nidpid(polnid, current->pid); 2381 this_cpupid = cpu_pid_to_cpupid(thiscpu, current->pid);
2380 2382
2381 /* 2383 /*
2382 * Multi-stage node selection is used in conjunction 2384 * Multi-stage node selection is used in conjunction
@@ -2399,8 +2401,8 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
2399 * it less likely we act on an unlikely task<->page 2401 * it less likely we act on an unlikely task<->page
2400 * relation. 2402 * relation.
2401 */ 2403 */
2402 last_nidpid = page_nidpid_xchg_last(page, this_nidpid); 2404 last_cpupid = page_cpupid_xchg_last(page, this_cpupid);
2403 if (!nidpid_pid_unset(last_nidpid) && nidpid_to_nid(last_nidpid) != polnid) 2405 if (!cpupid_pid_unset(last_cpupid) && cpupid_to_nid(last_cpupid) != thisnid)
2404 goto out; 2406 goto out;
2405 2407
2406#ifdef CONFIG_NUMA_BALANCING 2408#ifdef CONFIG_NUMA_BALANCING
@@ -2410,7 +2412,7 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
2410 * This way a short and temporary process migration will 2412 * This way a short and temporary process migration will
2411 * not cause excessive memory migration. 2413 * not cause excessive memory migration.
2412 */ 2414 */
2413 if (polnid != current->numa_preferred_nid && 2415 if (thisnid != current->numa_preferred_nid &&
2414 !current->numa_migrate_seq) 2416 !current->numa_migrate_seq)
2415 goto out; 2417 goto out;
2416#endif 2418#endif