linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Zi Yan <zi.yan@cs.rutgers.edu>
Cc: Zi Yan <zi.yan@sent.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Kirill A . Shutemov" <kirill@shutemov.name>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] Lock mmap_sem when calling migrate_pages() in do_move_pages_to_node()
Date: Tue, 30 Jan 2018 17:10:25 +0100	[thread overview]
Message-ID: <20180130161025.GH21609@dhcp22.suse.cz> (raw)
In-Reply-To: <5A7094DA.4000804@cs.rutgers.edu>

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2018-01-30 16:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30  3:00 Zi Yan
2018-01-30  4:10 ` Hugh Dickins
2018-01-30 15:56   ` Zi Yan
2018-01-30  8:14 ` Michal Hocko
2018-01-30 15:52   ` Zi Yan
2018-01-30 16:10     ` Michal Hocko [this message]
2018-01-30 19:12       ` Zi Yan
2018-01-31  8:01         ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180130161025.GH21609@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=zi.yan@cs.rutgers.edu \
    --cc=zi.yan@sent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox