mm: numa: do not automatically migrate KSM pages
authorMel Gorman <mgorman@suse.de>
Tue, 21 Jan 2014 23:51:02 +0000 (15:51 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 22 Jan 2014 00:19:48 +0000 (16:19 -0800)
KSM pages can be shared between tasks that are not necessarily related
to each other from a NUMA perspective.  This patch causes those pages to
be ignored by automatic NUMA balancing so they do not migrate and do not
cause unrelated tasks to be grouped together.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Alex Thorlton <athorlton@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mprotect.c

index bb53a6591aea1373d6bc74d5bb3e847650af8d24..7332c1785744fa0517a213b489e9c5b6bf350937 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/mmu_notifier.h>
 #include <linux/migrate.h>
 #include <linux/perf_event.h>
+#include <linux/ksm.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/cacheflush.h>
@@ -63,7 +64,7 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
 
                                ptent = *pte;
                                page = vm_normal_page(vma, addr, oldpte);
-                               if (page) {
+                               if (page && !PageKsm(page)) {
                                        if (!pte_numa(oldpte)) {
                                                ptent = pte_mknuma(ptent);
                                                set_pte_at(mm, addr, pte, ptent);