Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1729175
| From | Laurent Dufour <ldufour@linux.vnet.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 01/20] mm: Dont assume page-table invariance during faults |
| Date | 2017-09-08 20:20 +0200 |
| Message-ID | <unw2K-283-31@gated-at.bofh.it> (permalink) |
| References | <unvT3-24G-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Peter Zijlstra <peterz@infradead.org>
One of the side effects of speculating on faults (without holding
mmap_sem) is that we can race with free_pgtables() and therefore we
cannot assume the page-tables will stick around.
Remove the reliance on the pte pointer.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
mm/memory.c | 29 -----------------------------
1 file changed, 29 deletions(-)
diff --git a/mm/memory.c b/mm/memory.c
index ec4e15494901..30bccfa00630 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2270,30 +2270,6 @@ int apply_to_page_range(struct mm_struct *mm, unsigned long addr,
}
EXPORT_SYMBOL_GPL(apply_to_page_range);
-/*
- * handle_pte_fault chooses page fault handler according to an entry which was
- * read non-atomically. Before making any commitment, on those architectures
- * or configurations (e.g. i386 with PAE) which might give a mix of unmatched
- * parts, do_swap_page must check under lock before unmapping the pte and
- * proceeding (but do_wp_page is only called after already making such a check;
- * and do_anonymous_page can safely check later on).
- */
-static inline int pte_unmap_same(struct mm_struct *mm, pmd_t *pmd,
- pte_t *page_table, pte_t orig_pte)
-{
- int same = 1;
-#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
- if (sizeof(pte_t) > sizeof(unsigned long)) {
- spinlock_t *ptl = pte_lockptr(mm, pmd);
- spin_lock(ptl);
- same = pte_same(*page_table, orig_pte);
- spin_unlock(ptl);
- }
-#endif
- pte_unmap(page_table);
- return same;
-}
-
static inline void cow_user_page(struct page *dst, struct page *src, unsigned long va, struct vm_area_struct *vma)
{
debug_dma_assert_idle(src);
@@ -2854,11 +2830,6 @@ int do_swap_page(struct vm_fault *vmf)
if (vma_readahead)
page = swap_readahead_detect(vmf, &swap_ra);
- if (!pte_unmap_same(vma->vm_mm, vmf->pmd, vmf->pte, vmf->orig_pte)) {
- if (page)
- put_page(page);
- goto out;
- }
entry = pte_to_swp_entry(vmf->orig_pte);
if (unlikely(non_swap_entry(entry))) {
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 00/20] Speculative page faults Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-09-08 20:10 +0200 [PATCH v3 19/20] x86/mm: Add speculative pagefault handling Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-09-08 20:10 +0200 [PATCH v3 18/20] perf tools: Add support for the SPF perf event Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-09-08 20:10 +0200 [PATCH v3 17/20] perf: Add a speculative page fault sw event Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-09-08 20:10 +0200 [PATCH v3 13/20] mm: Introduce __page_add_new_anon_rmap() Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-09-08 20:20 +0200 [PATCH v3 10/20] mm: Introduce __lru_cache_add_active_or_unevictable Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-09-08 20:20 +0200 [PATCH v3 03/20] mm: Introduce pte_spinlock for FAULT_FLAG_SPECULATIVE Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-09-08 20:20 +0200 [PATCH v3 06/20] mm: RCU free VMAs Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-09-08 20:20 +0200 [PATCH v3 12/20] mm: Introduce __vm_normal_page() Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-09-08 20:20 +0200 [PATCH v3 05/20] mm: Protect VMA modifications using VMA sequence count Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-09-08 20:20 +0200 [PATCH v3 01/20] mm: Dont assume page-table invariance during faults Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-09-08 20:20 +0200 [PATCH v3 09/20] mm/migrate: Pass vm_fault pointer to migrate_misplaced_page() Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-09-08 20:20 +0200 [PATCH v3 16/20] mm: Adding speculative page fault failure trace events Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-09-08 20:20 +0200
csiph-web