aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mprotect.c
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2015-02-12 17:58:22 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-12 21:54:08 -0500
commit8a0516ed8b90c95ffa1363b420caa37418149f21 (patch)
tree64f95968661a136fa8a246419680420819dc1e0e /mm/mprotect.c
parente7bb4b6d1609cce391af1e7bc6f31d14f1a3a890 (diff)
mm: convert p[te|md]_numa users to p[te|md]_protnone_numa
Convert existing users of pte_numa and friends to the new helper. Note that the kernel is broken after this patch is applied until the other page table modifiers are also altered. This patch layout is to make review easier. Signed-off-by: Mel Gorman <mgorman@suse.de> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Acked-by: Aneesh Kumar <aneesh.kumar@linux.vnet.ibm.com> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Tested-by: Sasha Levin <sasha.levin@oracle.com> Cc: Dave Jones <davej@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Rik van Riel <riel@redhat.com> Cc: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mprotect.c')
-rw-r--r--mm/mprotect.c38
1 files changed, 10 insertions, 28 deletions
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 33121662f08b..44ffa698484d 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -75,36 +75,18 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
75 oldpte = *pte; 75 oldpte = *pte;
76 if (pte_present(oldpte)) { 76 if (pte_present(oldpte)) {
77 pte_t ptent; 77 pte_t ptent;
78 bool updated = false;
79 78
80 if (!prot_numa) { 79 ptent = ptep_modify_prot_start(mm, addr, pte);
81 ptent = ptep_modify_prot_start(mm, addr, pte); 80 ptent = pte_modify(ptent, newprot);
82 if (pte_numa(ptent)) 81
83 ptent = pte_mknonnuma(ptent); 82 /* Avoid taking write faults for known dirty pages */
84 ptent = pte_modify(ptent, newprot); 83 if (dirty_accountable && pte_dirty(ptent) &&
85 /* 84 (pte_soft_dirty(ptent) ||
86 * Avoid taking write faults for pages we 85 !(vma->vm_flags & VM_SOFTDIRTY))) {
87 * know to be dirty. 86 ptent = pte_mkwrite(ptent);
88 */
89 if (dirty_accountable && pte_dirty(ptent) &&
90 (pte_soft_dirty(ptent) ||
91 !(vma->vm_flags & VM_SOFTDIRTY)))
92 ptent = pte_mkwrite(ptent);
93 ptep_modify_prot_commit(mm, addr, pte, ptent);
94 updated = true;
95 } else {
96 struct page *page;
97
98 page = vm_normal_page(vma, addr, oldpte);
99 if (page && !PageKsm(page)) {
100 if (!pte_numa(oldpte)) {
101 ptep_set_numa(mm, addr, pte);
102 updated = true;
103 }
104 }
105 } 87 }
106 if (updated) 88 ptep_modify_prot_commit(mm, addr, pte, ptent);
107 pages++; 89 pages++;
108 } else if (IS_ENABLED(CONFIG_MIGRATION)) { 90 } else if (IS_ENABLED(CONFIG_MIGRATION)) {
109 swp_entry_t entry = pte_to_swp_entry(oldpte); 91 swp_entry_t entry = pte_to_swp_entry(oldpte);
110 92