lkml.org 
[lkml]   [2015]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/4] mm: migrate: Batch TLB flushing when unmapping pages for migration
On Thu, Apr 16, 2015 at 11:57:15AM -0700, Hugh Dickins wrote:
> > @@ -1098,6 +1098,8 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
> > if (!swapwrite)
> > current->flags |= PF_SWAPWRITE;
> >
> > + alloc_tlb_ubc();
> > +
> > for(pass = 0; pass < 10 && retry; pass++) {
> > retry = 0;
> >
> > @@ -1144,6 +1146,8 @@ out:
> > if (!swapwrite)
> > current->flags &= ~PF_SWAPWRITE;
> >
> > + try_to_unmap_flush();
>
> This is the right place to aim to flush, but I think you have to make
> more changes before it is safe to do so here.
>
> The putback_lru_page(page) in unmap_and_move() is commented "A page
> that has been migrated has all references removed and will be freed".
>
> If you leave TLB flushing until after the page has been freed, then
> there's a risk that userspace will see, not the data it expects at
> whatever virtual address, but data placed in there by the next user
> of this freed page.
>
> So you'll need to do a little restructuring first.
>

Well spotted. I believe you are correct and it almost certainly applies to
patch 2 as well for similar reasons. It also impacts the maximum reasonable
batch size that can be managed while maintaing safety. I'll do the necessary
shuffling tomorrow or Monday.

--
Mel Gorman
SUSE Labs


\
 
 \ /
  Last update: 2015-04-16 22:01    [W:0.077 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site