Re: [PATCH] Lock mmap_sem when calling migrate_pages() in do_move_pages_to_node()

2018-01-31 Thread Michal Hocko
On Tue 30-01-18 14:12:28, Zi Yan wrote: > On 30 Jan 2018, at 11:10, Michal Hocko wrote: [...] > I think the question is whether we need to hold mmap_sem for > migrate_pages(). Hugh also agrees it is not necessary on a separate > email. But it is held in the original code. I would be really surpris

Re: [PATCH] Lock mmap_sem when calling migrate_pages() in do_move_pages_to_node()

2018-01-30 Thread Zi Yan
On 30 Jan 2018, at 11:10, Michal Hocko wrote: > On Tue 30-01-18 10:52:58, Zi Yan wrote: >> >> >> Michal Hocko wrote: >>> On Mon 29-01-18 22:00:11, Zi Yan wrote: From: Zi Yan migrate_pages() requires at least down_read(mmap_sem) to protect related page tables and VMAs from chan

Re: [PATCH] Lock mmap_sem when calling migrate_pages() in do_move_pages_to_node()

2018-01-30 Thread Michal Hocko
On Tue 30-01-18 10:52:58, Zi Yan wrote: > > > Michal Hocko wrote: > > On Mon 29-01-18 22:00:11, Zi Yan wrote: > >> From: Zi Yan > >> > >> migrate_pages() requires at least down_read(mmap_sem) to protect > >> related page tables and VMAs from changing. Let's do it in > >> do_page_moves() for both

Re: [PATCH] Lock mmap_sem when calling migrate_pages() in do_move_pages_to_node()

2018-01-30 Thread Zi Yan
Hugh Dickins wrote: > On Mon, 29 Jan 2018, Zi Yan wrote: >> From: Zi Yan >> >> migrate_pages() requires at least down_read(mmap_sem) to protect >> related page tables and VMAs from changing. Let's do it in > > Page tables are protected by their locks. VMAs may change while > migration is activ

Re: [PATCH] Lock mmap_sem when calling migrate_pages() in do_move_pages_to_node()

2018-01-30 Thread Zi Yan
Michal Hocko wrote: > On Mon 29-01-18 22:00:11, Zi Yan wrote: >> From: Zi Yan >> >> migrate_pages() requires at least down_read(mmap_sem) to protect >> related page tables and VMAs from changing. Let's do it in >> do_page_moves() for both do_move_pages_to_node() and >> add_page_for_migration().

Re: [PATCH] Lock mmap_sem when calling migrate_pages() in do_move_pages_to_node()

2018-01-30 Thread Michal Hocko
On Mon 29-01-18 22:00:11, Zi Yan wrote: > From: Zi Yan > > migrate_pages() requires at least down_read(mmap_sem) to protect > related page tables and VMAs from changing. Let's do it in > do_page_moves() for both do_move_pages_to_node() and > add_page_for_migration(). > > Also add this lock requi

Re: [PATCH] Lock mmap_sem when calling migrate_pages() in do_move_pages_to_node()

2018-01-29 Thread Hugh Dickins
On Mon, 29 Jan 2018, Zi Yan wrote: > From: Zi Yan > > migrate_pages() requires at least down_read(mmap_sem) to protect > related page tables and VMAs from changing. Let's do it in Page tables are protected by their locks. VMAs may change while migration is active on them, but does that need loc

[PATCH] Lock mmap_sem when calling migrate_pages() in do_move_pages_to_node()

2018-01-29 Thread Zi Yan
From: Zi Yan migrate_pages() requires at least down_read(mmap_sem) to protect related page tables and VMAs from changing. Let's do it in do_page_moves() for both do_move_pages_to_node() and add_page_for_migration(). Also add this lock requirement in the comment of migrate_pages(). Signed-off-by