aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/memory.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 71b161b73bb5..0e18b4d649ec 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2680,10 +2680,12 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
2680 delayacct_clear_flag(DELAYACCT_PF_SWAPIN); 2680 delayacct_clear_flag(DELAYACCT_PF_SWAPIN);
2681 2681
2682 /* 2682 /*
2683 * Make sure try_to_free_swap didn't release the swapcache 2683 * Make sure try_to_free_swap or reuse_swap_page or swapoff did not
2684 * from under us. The page pin isn't enough to prevent that. 2684 * release the swapcache from under us. The page pin, and pte_same
2685 * test below, are not enough to exclude that. Even if it is still
2686 * swapcache, we need to check that the page's swap has not changed.
2685 */ 2687 */
2686 if (unlikely(!PageSwapCache(page))) 2688 if (unlikely(!PageSwapCache(page) || page_private(page) != entry.val))
2687 goto out_page; 2689 goto out_page;
2688 2690
2689 if (ksm_might_need_to_copy(page, vma, address)) { 2691 if (ksm_might_need_to_copy(page, vma, address)) {