diff options
author | Rik van Riel <riel@redhat.com> | 2012-11-06 04:54:47 -0500 |
---|---|---|
committer | Mel Gorman <mgorman@suse.de> | 2012-12-11 09:28:33 -0500 |
commit | 0f9a921cf9bf3b524feddc484e2b4d070b7ca0d0 (patch) | |
tree | 4cad5a73d90a09863cb7615685f93e59192f256f /arch | |
parent | f4a75d2eb7b1e2206094b901be09adb31ba63681 (diff) |
x86: mm: only do a local tlb flush in ptep_set_access_flags()
The function ptep_set_access_flags() is only ever invoked to set access
flags or add write permission on a PTE. The write bit is only ever set
together with the dirty bit.
Because we only ever upgrade a PTE, it is safe to skip flushing entries on
remote TLBs. The worst that can happen is a spurious page fault on other
CPUs, which would flush that TLB entry.
Lazily letting another CPU incur a spurious page fault occasionally is
(much!) cheaper than aggressively flushing everybody else's TLB.
Signed-off-by: Rik van Riel <riel@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Michel Lespinasse <walken@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/mm/pgtable.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index 8573b83a63d0..be3bb4690887 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c | |||
@@ -301,6 +301,13 @@ void pgd_free(struct mm_struct *mm, pgd_t *pgd) | |||
301 | free_page((unsigned long)pgd); | 301 | free_page((unsigned long)pgd); |
302 | } | 302 | } |
303 | 303 | ||
304 | /* | ||
305 | * Used to set accessed or dirty bits in the page table entries | ||
306 | * on other architectures. On x86, the accessed and dirty bits | ||
307 | * are tracked by hardware. However, do_wp_page calls this function | ||
308 | * to also make the pte writeable at the same time the dirty bit is | ||
309 | * set. In that case we do actually need to write the PTE. | ||
310 | */ | ||
304 | int ptep_set_access_flags(struct vm_area_struct *vma, | 311 | int ptep_set_access_flags(struct vm_area_struct *vma, |
305 | unsigned long address, pte_t *ptep, | 312 | unsigned long address, pte_t *ptep, |
306 | pte_t entry, int dirty) | 313 | pte_t entry, int dirty) |
@@ -310,7 +317,7 @@ int ptep_set_access_flags(struct vm_area_struct *vma, | |||
310 | if (changed && dirty) { | 317 | if (changed && dirty) { |
311 | *ptep = entry; | 318 | *ptep = entry; |
312 | pte_update_defer(vma->vm_mm, address, ptep); | 319 | pte_update_defer(vma->vm_mm, address, ptep); |
313 | flush_tlb_page(vma, address); | 320 | __flush_tlb_one(address); |
314 | } | 321 | } |
315 | 322 | ||
316 | return changed; | 323 | return changed; |