lkml.org 
[lkml]   [2018]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/3] mm, numa: rework do_pages_move
On Mon, 29 Jan 2018 18:39:01 -0500 "Zi Yan" <zi.yan@cs.rutgers.edu> wrote:

> On 29 Jan 2018, at 17:35, Andrew Morton wrote:
>
> > On Mon, 29 Jan 2018 17:06:14 -0500 "Zi Yan" <zi.yan@cs.rutgers.edu> wrote:
> >
> >> I discover that this patch does not hold mmap_sem while migrating pages in
> >> do_move_pages_to_node().
> >>
> >> A simple fix below moves mmap_sem from add_page_for_migration()
> >> to the outmost do_pages_move():
> >
> > I'm not surprised. Why does do_move_pages_to_node() need mmap_sem
> > and how is a reader to discover that fact???
>
> do_move_pages_to_node() calls migrate_pages(), which requires down_read(&mmap_sem).
>
> In the outmost do_pages_move(), both add_page_for_migration() and
> do_move_pages_to_node() inside it need to hold read lock of mmap_sem.
>
> Do we need to add comments for both functions?

Just for migrate_pages(), I guess. Let's include a description of
*why* mmap_sem is needed. What it is protecting.

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