Cc: KOSAKI Motohiro <kosaki.motohiro@...>, Andrew Morton <akpm@...>, Rik van Riel <riel@...>, Lee Schermerhorn <lee.schermerhorn@...>, Nick Piggin <npiggin@...>, <linux-mm@...>, <linux-kernel@...>, <kernel-testers@...>
I agree with Kosaki-san.
And VM_BUG_ON(page_count(newpage) != 1) in unmap_and_move()
is not correct again, IMHO.
I got this BUG actually when testing this patch(with
migratin_entry_wait fix).
unmap_and_move()
move_to_new_page()
migrate_page()
remove_migration_ptes()
putback_lru_page() (*1)
:
if (!newpage->mapping) (*2)
VM_BUG_ON(page_count(newpage) != 1)
If a anonymous page(without mapping) is migrated successfully,
this page is moved back to lru by putback_lru_page()(*1),
and the page count becomes 1(pte only).
At the same time(between *1 and *2), if the process
that owns this page are freeing this page, the page count
becomes 0 and ->mapping becomes NULL by free_hot_cold_page(),
so this BUG is caused.
I've not seen this BUG on real HW yet(seen twice on fake-numa
hvm guest of Xen), but I think it can happen theoretically.
Thanks,
Daisuke Nishimura.
--