Re: [PATCH RFC 20/24] userfaultfd: wp: don't wake up when doing write protect

From: Peter Xu
Date: Thu Jan 24 2019 - 00:37:03 EST


On Mon, Jan 21, 2019 at 01:10:39PM +0200, Mike Rapoport wrote:
> On Mon, Jan 21, 2019 at 03:57:18PM +0800, Peter Xu wrote:
> > It does not make sense to try to wake up any waiting thread when we're
> > write-protecting a memory region. Only wake up when resolving a write
> > protected page fault.
>
> Probably it would be better to make it default to wake up only when
> requested explicitly?

Yes, I think that's what this series does?

Now when we do UFFDIO_WRITEPROTECT with !WP and !DONTWAKE then we'll
first resolve the page fault, then wake up the process properly. And
we request that explicity using !WP and DONTWAKE.

Or did I misunderstood the question?

> Then we can simply disallow _DONTWAKE for uffd_wp and only use
> UFFDIO_WRITEPROTECT_MODE_WP as possible mode.

I'd admit I don't know the major usage of DONTWAKE (and I'd be glad to
know...), however since we have this flag for both UFFDIO_COPY and
UFFDIO_ZEROCOPY, then it seems sane to have DONTWAKE for WRITEPROTECT
too? Or is there any other explicit reason to omit it?

Thanks!

--
Peter Xu