From: Mel Gorman <[email protected]>
Subject: mm: numa: clear numa hinting information on mprotect

On a protection change it is no longer clear if the page should be still
accessible.  This patch clears the NUMA hinting fault bits on a protection
change.

Signed-off-by: Mel Gorman <[email protected]>
Reviewed-by: Rik van Riel <[email protected]>
Cc: Alex Thorlton <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 mm/huge_memory.c |    2 ++
 mm/mprotect.c    |    2 ++
 2 files changed, 4 insertions(+)

diff -puN mm/huge_memory.c~mm-numa-clear-numa-hinting-information-on-mprotect 
mm/huge_memory.c
--- a/mm/huge_memory.c~mm-numa-clear-numa-hinting-information-on-mprotect
+++ a/mm/huge_memory.c
@@ -1532,6 +1532,8 @@ int change_huge_pmd(struct vm_area_struc
                ret = 1;
                if (!prot_numa) {
                        entry = pmdp_get_and_clear(mm, addr, pmd);
+                       if (pmd_numa(entry))
+                               entry = pmd_mknonnuma(entry);
                        entry = pmd_modify(entry, newprot);
                        ret = HPAGE_PMD_NR;
                        BUG_ON(pmd_write(entry));
diff -puN mm/mprotect.c~mm-numa-clear-numa-hinting-information-on-mprotect 
mm/mprotect.c
--- a/mm/mprotect.c~mm-numa-clear-numa-hinting-information-on-mprotect
+++ a/mm/mprotect.c
@@ -54,6 +54,8 @@ static unsigned long change_pte_range(st
 
                        if (!prot_numa) {
                                ptent = ptep_modify_prot_start(mm, addr, pte);
+                               if (pte_numa(ptent))
+                                       ptent = pte_mknonnuma(ptent);
                                ptent = pte_modify(ptent, newprot);
                                updated = true;
                        } else {
_
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to