--- v1
+++ v4
@@ -7,54 +7,56 @@
Remove the reliance on the pte pointer.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+
+[Remove only if !__HAVE_ARCH_CALL_SPF]
+Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
---
- mm/memory.c | 27 ---------------------------
- 1 file changed, 27 deletions(-)
+ mm/memory.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/mm/memory.c b/mm/memory.c
-index f65beaad319b..d08f494f1b37 100644
+index 6632c9b357c9..4e4fe233d066 100644
--- a/mm/memory.c
+++ b/mm/memory.c
-@@ -2103,30 +2103,6 @@ int apply_to_page_range(struct mm_struct *mm, unsigned long addr,
+@@ -2287,6 +2287,7 @@ 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,
++#ifndef __HAVE_ARCH_CALL_SPF
+ /*
+ * handle_pte_fault chooses page fault handler according to an entry which was
+ * read non-atomically. Before making any commitment, on those architectures
+@@ -2296,7 +2297,7 @@ EXPORT_SYMBOL_GPL(apply_to_page_range);
+ * 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;
--}
--
++ pte_t *page_table, pte_t orig_pte)
+ {
+ int same = 1;
+ #if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
+@@ -2310,6 +2311,7 @@ static inline int pte_unmap_same(struct mm_struct *mm, pmd_t *pmd,
+ pte_unmap(page_table);
+ return same;
+ }
++#endif
+
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);
-@@ -2683,9 +2659,6 @@ int do_swap_page(struct vm_fault *vmf)
- int exclusive = 0;
- int ret = 0;
+@@ -2871,11 +2873,14 @@ int do_swap_page(struct vm_fault *vmf)
-- if (!pte_unmap_same(vma->vm_mm, vmf->pmd, vmf->pte, vmf->orig_pte))
-- goto out;
--
+ if (vma_readahead)
+ page = swap_readahead_detect(vmf, &swap_ra);
++
++#ifndef __HAVE_ARCH_CALL_SPF
+ if (!pte_unmap_same(vma->vm_mm, vmf->pmd, vmf->pte, vmf->orig_pte)) {
+ if (page)
+ put_page(page);
+ goto out;
+ }
++#endif
+
entry = pte_to_swp_entry(vmf->orig_pte);
if (unlikely(non_swap_entry(entry))) {
- if (is_migration_entry(entry)) {
--
2.7.4