diff --git a/mm/memory.c b/mm/memory.c index b8846cf2358a54fb9903568fc50dbd69ab3d2bce..1c0a3db78a052e2ad0e166b9b0c1af44109623da 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1239,7 +1239,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct * vma, } old_page = pfn_to_page(pfn); - if (!TestSetPageLocked(old_page)) { + if (PageAnon(old_page) && !TestSetPageLocked(old_page)) { int reuse = can_share_swap_page(old_page); unlock_page(old_page); if (reuse) {