diff options
author | Hugh Dickins <hughd@google.com> | 2011-01-13 18:46:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 20:32:38 -0500 |
commit | ae52a2adb5afa5ac5ec5fb5c7b24777f84b6c926 (patch) | |
tree | fb02d8fb1699c85cc278e2333ce25916835bf341 /mm/ksm.c | |
parent | 240c879f20a605346705be24253bc9fc6fa8a106 (diff) |
thp: ksm: free swap when swapcache page is replaced
When a swapcache page is replaced by a ksm page, it's best to free that
swap immediately.
Reported-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/ksm.c')
-rw-r--r-- | mm/ksm.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -800,6 +800,8 @@ static int replace_page(struct vm_area_struct *vma, struct page *page, | |||
800 | set_pte_at_notify(mm, addr, ptep, mk_pte(kpage, vma->vm_page_prot)); | 800 | set_pte_at_notify(mm, addr, ptep, mk_pte(kpage, vma->vm_page_prot)); |
801 | 801 | ||
802 | page_remove_rmap(page); | 802 | page_remove_rmap(page); |
803 | if (!page_mapped(page)) | ||
804 | try_to_free_swap(page); | ||
803 | put_page(page); | 805 | put_page(page); |
804 | 806 | ||
805 | pte_unmap_unlock(ptep, ptl); | 807 | pte_unmap_unlock(ptep, ptl); |