Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae52a2ad authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds
Browse files

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: default avatarAndrea Arcangeli <aarcange@redhat.com>
Signed-off-by: default avatarHugh Dickins <hughd@google.com>
Signed-off-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 240c879f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -800,6 +800,8 @@ static int replace_page(struct vm_area_struct *vma, struct page *page,
	set_pte_at_notify(mm, addr, ptep, mk_pte(kpage, vma->vm_page_prot));

	page_remove_rmap(page);
	if (!page_mapped(page))
		try_to_free_swap(page);
	put_page(page);

	pte_unmap_unlock(ptep, ptl);