Re: [PATCH 3/3] mm,migration: Remove straggling migration PTEs when page tables are being moved after the VMA has already moved

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Thanks to you both for looking into this. I far prefer this general approach
than cleaning up the migration PTEs as the page tables get copied. While it
might "work", it's sloppy in the same way as having migration_entry_wait()
do the cleanup was sloppy. It's far preferable to make the VMA move and
page table copy atomic with anon_vma->lock.

On Wed, Apr 28, 2010 at 04:28:38PM +0900, KAMEZAWA Hiroyuki wrote:

The biggest problem is that the reverse mapping is temporarily out of
sync until do_exit gets rid of the mess, but how serious is that really?

If there is a migration entry in there, the mapcount should already be zero and
migration holds a reference to the page to prevent it going away. rmap_walk()
may then miss the migration_pte so it gets left behind. Ordinarily this
would be bad but in exec(), we cannot be faulting this page so we won't
trigger the bug in swapops. Instead, do_exit ultimately will skip over the
migration PTE doing nothing with the page but as the mapcount is still zero,
the page won't leak.


I see the point of your patch but I'm not yet seeing why it is
necessary to back out if move_page_tables fails.

That said, both patches have a greater problem. Both of them hold a spinlock
(anon_vma->lock) while calling into the page allocator with GFP_KERNEL (to
allocate the page tables). We don't want to change that to GFP_ATOMIC so
either we need to allocate the pages in advance or special case rmap_walk()
to not walk processes that are in exec.

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/3] Fix migration races in rmap_walk() V2, Mel Gorman, (Tue Apr 27, 2:30 pm)
Re: [PATCH 0/3] Fix migration races in rmap_walk() V2, Christoph Lameter, (Tue Apr 27, 3:27 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., Andrea Arcangeli, (Tue Apr 27, 3:30 pm)
Re: [PATCH 0/3] Fix migration races in rmap_walk() V2, Andrea Arcangeli, (Tue Apr 27, 3:32 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., Andrea Arcangeli, (Tue Apr 27, 3:58 pm)
Re: [PATCH 1/3] mm,migration: During fork(), wait for migr ..., KAMEZAWA Hiroyuki, (Tue Apr 27, 4:52 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., KAMEZAWA Hiroyuki, (Tue Apr 27, 5:03 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., Andrea Arcangeli, (Tue Apr 27, 5:08 pm)
Re: [PATCH 0/3] Fix migration races in rmap_walk() V2, KAMEZAWA Hiroyuki, (Tue Apr 27, 5:13 pm)
Re: [PATCH 0/3] Fix migration races in rmap_walk() V2, Andrea Arcangeli, (Tue Apr 27, 5:20 pm)
Re: [PATCH 1/3] mm,migration: During fork(), wait for migr ..., KAMEZAWA Hiroyuki, (Tue Apr 27, 5:28 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., KAMEZAWA Hiroyuki, (Tue Apr 27, 5:36 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., KAMEZAWA Hiroyuki, (Tue Apr 27, 5:39 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., Andrea Arcangeli, (Tue Apr 27, 6:05 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., Andrea Arcangeli, (Tue Apr 27, 6:09 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., KAMEZAWA Hiroyuki, (Tue Apr 27, 6:18 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., KAMEZAWA Hiroyuki, (Tue Apr 27, 6:29 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., Andrea Arcangeli, (Tue Apr 27, 6:36 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., Andrea Arcangeli, (Tue Apr 27, 6:44 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., KAMEZAWA Hiroyuki, (Tue Apr 27, 7:12 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., Andrea Arcangeli, (Tue Apr 27, 7:42 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., KAMEZAWA Hiroyuki, (Tue Apr 27, 7:49 pm)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., KAMEZAWA Hiroyuki, (Wed Apr 28, 12:28 am)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., KAMEZAWA Hiroyuki, (Wed Apr 28, 1:30 am)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., Mel Gorman, (Wed Apr 28, 3:48 am)
Re: [PATCH 3/3] mm,migration: Remove straggling migration ..., Andrea Arcangeli, (Wed Apr 28, 7:46 am)
Re: [PATCH 0/3] Fix migration races in rmap_walk() V2, Andrea Arcangeli, (Wed Apr 28, 8:16 am)
Re: [PATCH 0/3] Fix migration races in rmap_walk() V2, Andrea Arcangeli, (Wed Apr 28, 8:45 am)
[RFC PATCH] take all anon_vma locks in anon_vma_lock, Rik van Riel, (Wed Apr 28, 10:47 am)
Re: [PATCH 2/3] mm,migration: Prevent rmap_walk_[anon|ksm] ..., Andrea Arcangeli, (Wed Apr 28, 10:58 am)
Re: [RFC PATCH] take all anon_vma locks in anon_vma_lock, Andrea Arcangeli, (Wed Apr 28, 11:03 am)
Re: [RFC PATCH] take all anon_vma locks in anon_vma_lock, Rik van Riel, (Wed Apr 28, 11:09 am)
[RFC PATCH -v2] take all anon_vma locks in anon_vma_lock, Rik van Riel, (Wed Apr 28, 11:25 am)
Re: [PATCH 0/3] Fix migration races in rmap_walk() V2, Andrea Arcangeli, (Wed Apr 28, 1:40 pm)
Re: [PATCH 0/3] Fix migration races in rmap_walk() V2, Andrea Arcangeli, (Wed Apr 28, 2:05 pm)