aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/mm/memory.c b/mm/memory.c
index f594bb65a9f1..3922ffcf3dff 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1848,10 +1848,21 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
1848 * not dirty accountable. 1848 * not dirty accountable.
1849 */ 1849 */
1850 if (PageAnon(old_page)) { 1850 if (PageAnon(old_page)) {
1851 if (trylock_page(old_page)) { 1851 if (!trylock_page(old_page)) {
1852 reuse = can_share_swap_page(old_page); 1852 page_cache_get(old_page);
1853 unlock_page(old_page); 1853 pte_unmap_unlock(page_table, ptl);
1854 lock_page(old_page);
1855 page_table = pte_offset_map_lock(mm, pmd, address,
1856 &ptl);
1857 if (!pte_same(*page_table, orig_pte)) {
1858 unlock_page(old_page);
1859 page_cache_release(old_page);
1860 goto unlock;
1861 }
1862 page_cache_release(old_page);
1854 } 1863 }
1864 reuse = can_share_swap_page(old_page);
1865 unlock_page(old_page);
1855 } else if (unlikely((vma->vm_flags & (VM_WRITE|VM_SHARED)) == 1866 } else if (unlikely((vma->vm_flags & (VM_WRITE|VM_SHARED)) ==
1856 (VM_WRITE|VM_SHARED))) { 1867 (VM_WRITE|VM_SHARED))) {
1857 /* 1868 /*