Re: [PATCH RFC 00/30] userfaultfd-wp: Support shmem and hugetlbfs

From: Peter Xu
Date: Fri Feb 05 2021 - 22:46:24 EST


On Fri, Feb 05, 2021 at 02:21:47PM -0800, Hugh Dickins wrote:
> On Fri, 29 Jan 2021, Peter Xu wrote:
> >
> > Huge & Mike,
> >
> > Would any of you have comment/concerns on the high-level design of this series?
> >
> > It would be great to know it, especially major objection, before move on to an
> > non-rfc version.
>
> Seeing Mike's update prompts me to speak up: I have been looking, and
> will continue to look through it - will report when done; but find I've
> been making very little forward progress from one day to the next.
>
> It is very confusing, inevitably; but you have done an *outstanding*
> job on acknowledging the confusion, and commenting it in great detail.

I'm honored to receive such an evaluation, thanks Hugh!

As a quick summary - what I did in this series is mostly what you've suggested
on using swp_type==1 && swp_offset=0 as a special pte, so the swap code can
trap it. The only difference is that "swp_type==1 && swp_offset=0" still uses
valid swp_entry address space, so I introduced the "swap special pte" idea
hoping to make it clearer, which is also based on Andrea's suggestion. I hope
I didn't make it even worse. :)

It's just that I don't want to make this idea that "only works for uffd-wp".
What I'm thinking is whether we can provide such a common way to keep some
records in pgtable entries that point to file-backed memory. Say, currently
for a file-backed memory we can only have either a valid pte (either RO or RW)
or a none pte. So maybe we could provide a way to start using the rest pte
address space that we haven't yet used.

Please take your time on reviewing the series. Any of your future comment
would be greatly welcomed.

Thanks,

--
Peter Xu