lkml.org 
[lkml]   [2018]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 1/8] mm: mmap: unmap large mapping by section
On Thu, Mar 22, 2018 at 05:18:55PM +0100, Laurent Dufour wrote:
> > It's *really* rare to page-fault on a VMA which is in the middle of
> > being replaced. Why are you trying to optimise it?
>
> I was not trying to optimize it, but to not wait in the page fault handler.
> This could become tricky in the case the VMA is removed once mmap(MAP_FIXED) is
> done and before the waiting page fault got woken up. This means that the
> removed VMA structure will have to remain until all the waiters are woken up
> which implies ref_count or similar.

Yes, that's why we don't want an actual rwsem. What I had in mind was
a struct completion on the stack of the caller of munmap(), and a pointer
to it from the vma. The page fault handler grabs the VMA tree lock, walks
the VMA tree and finds a VMA. If the VMA is marked as locked, it waits
for the completion. Upon wakeup *it does not look at the VMA*, instead it
restarts the page fault.

\
 
 \ /
  Last update: 2018-03-22 17:51    [W:0.109 / U:0.856 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site