[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180322165102.GF28468@bombadil.infradead.org>
Date: Thu, 22 Mar 2018 09:51:03 -0700
From: Matthew Wilcox <willy@...radead.org>
To: Laurent Dufour <ldufour@...ux.vnet.ibm.com>
Cc: Yang Shi <yang.shi@...ux.alibaba.com>,
Michal Hocko <mhocko@...nel.org>, akpm@...ux-foundation.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [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.
Powered by blists - more mailing lists