diff options
-rw-r--r-- | mm/memory.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/mm/memory.c b/mm/memory.c index 02e48aa0ed13..d0cc1c134a64 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -2112,7 +2112,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2112 | { | 2112 | { |
2113 | struct page *old_page, *new_page; | 2113 | struct page *old_page, *new_page; |
2114 | pte_t entry; | 2114 | pte_t entry; |
2115 | int reuse = 0, ret = 0; | 2115 | int ret = 0; |
2116 | int page_mkwrite = 0; | 2116 | int page_mkwrite = 0; |
2117 | struct page *dirty_page = NULL; | 2117 | struct page *dirty_page = NULL; |
2118 | 2118 | ||
@@ -2149,14 +2149,16 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2149 | } | 2149 | } |
2150 | page_cache_release(old_page); | 2150 | page_cache_release(old_page); |
2151 | } | 2151 | } |
2152 | reuse = reuse_swap_page(old_page); | 2152 | if (reuse_swap_page(old_page)) { |
2153 | if (reuse) | ||
2154 | /* | 2153 | /* |
2155 | * The page is all ours. Move it to our anon_vma so | 2154 | * The page is all ours. Move it to our anon_vma so |
2156 | * the rmap code will not search our parent or siblings. | 2155 | * the rmap code will not search our parent or siblings. |
2157 | * Protected against the rmap code by the page lock. | 2156 | * Protected against the rmap code by the page lock. |
2158 | */ | 2157 | */ |
2159 | page_move_anon_rmap(old_page, vma, address); | 2158 | page_move_anon_rmap(old_page, vma, address); |
2159 | unlock_page(old_page); | ||
2160 | goto reuse; | ||
2161 | } | ||
2160 | unlock_page(old_page); | 2162 | unlock_page(old_page); |
2161 | } else if (unlikely((vma->vm_flags & (VM_WRITE|VM_SHARED)) == | 2163 | } else if (unlikely((vma->vm_flags & (VM_WRITE|VM_SHARED)) == |
2162 | (VM_WRITE|VM_SHARED))) { | 2164 | (VM_WRITE|VM_SHARED))) { |
@@ -2220,10 +2222,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2220 | } | 2222 | } |
2221 | dirty_page = old_page; | 2223 | dirty_page = old_page; |
2222 | get_page(dirty_page); | 2224 | get_page(dirty_page); |
2223 | reuse = 1; | ||
2224 | } | ||
2225 | 2225 | ||
2226 | if (reuse) { | ||
2227 | reuse: | 2226 | reuse: |
2228 | flush_cache_page(vma, address, pte_pfn(orig_pte)); | 2227 | flush_cache_page(vma, address, pte_pfn(orig_pte)); |
2229 | entry = pte_mkyoung(orig_pte); | 2228 | entry = pte_mkyoung(orig_pte); |