lkml.org 
[lkml]   [2018]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Lock mmap_sem when calling migrate_pages() in do_move_pages_to_node()
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 <zi.yan@cs.rutgers.edu>
> >>
> >> 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().
> >
> > This doesn't make much sense to me, to be honest. We are holding
> > mmap_sem for _read_ so we allow parallel updates like page faults
> > or unmaps. Therefore we are isolating pages prior to the migration.
> >
> > The sole purpose of the mmap_sem in add_page_for_migration is to protect
> > from vma going away _while_ need it to get the proper page.
>
> Then, I am wondering why we are holding mmap_sem when calling
> migrate_pages() in existing code.
> http://elixir.free-electrons.com/linux/latest/source/mm/migrate.c#L1576

You mean in the original code? I strongly suspect this was to not take
it for each page.
--
Michal Hocko
SUSE Labs

\
 
 \ /
  Last update: 2018-01-30 17:10    [W:0.049 / U:0.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site