aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2013-12-18 20:08:37 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-12-18 22:04:51 -0500
commit0c5f83c23ca703d32f930393825487257a5cde6d (patch)
tree380066a66f3f36fa56c5a772e289ef4f06d3c1ec /mm
parent5a6dac3ec5f583cc8ee7bc53b5500a207c4ca433 (diff)
mm: numa: do not clear PTE for pte_numa update
The TLB must be flushed if the PTE is updated but change_pte_range is clearing the PTE while marking PTEs pte_numa without necessarily flushing the TLB if it reinserts the same entry. Without the flush, it's conceivable that two processors have different TLBs for the same virtual address and at the very least it would generate spurious faults. This patch only unmaps the pages in change_pte_range for a full protection change. [riel@redhat.com: write pte_numa pte back to the page tables] Signed-off-by: Mel Gorman <mgorman@suse.de> Signed-off-by: Rik van Riel <riel@redhat.com> Reviewed-by: Rik van Riel <riel@redhat.com> Cc: Alex Thorlton <athorlton@sgi.com> Cc: Chegu Vinod <chegu_vinod@hp.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/mprotect.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 26667971c824..1291a053b167 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -52,17 +52,19 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
52 pte_t ptent; 52 pte_t ptent;
53 bool updated = false; 53 bool updated = false;
54 54
55 ptent = ptep_modify_prot_start(mm, addr, pte);
56 if (!prot_numa) { 55 if (!prot_numa) {
56 ptent = ptep_modify_prot_start(mm, addr, pte);
57 ptent = pte_modify(ptent, newprot); 57 ptent = pte_modify(ptent, newprot);
58 updated = true; 58 updated = true;
59 } else { 59 } else {
60 struct page *page; 60 struct page *page;
61 61
62 ptent = *pte;
62 page = vm_normal_page(vma, addr, oldpte); 63 page = vm_normal_page(vma, addr, oldpte);
63 if (page) { 64 if (page) {
64 if (!pte_numa(oldpte)) { 65 if (!pte_numa(oldpte)) {
65 ptent = pte_mknuma(ptent); 66 ptent = pte_mknuma(ptent);
67 set_pte_at(mm, addr, pte, ptent);
66 updated = true; 68 updated = true;
67 } 69 }
68 } 70 }
@@ -79,7 +81,10 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
79 81
80 if (updated) 82 if (updated)
81 pages++; 83 pages++;
82 ptep_modify_prot_commit(mm, addr, pte, ptent); 84
85 /* Only !prot_numa always clears the pte */
86 if (!prot_numa)
87 ptep_modify_prot_commit(mm, addr, pte, ptent);
83 } else if (IS_ENABLED(CONFIG_MIGRATION) && !pte_file(oldpte)) { 88 } else if (IS_ENABLED(CONFIG_MIGRATION) && !pte_file(oldpte)) {
84 swp_entry_t entry = pte_to_swp_entry(oldpte); 89 swp_entry_t entry = pte_to_swp_entry(oldpte);
85 90