Re: [PATCH] ioctl_userfaultfd.2, userfaultfd.2: add minor fault mode

From: Peter Xu
Date: Thu Jun 03 2021 - 15:29:03 EST


On Thu, Jun 03, 2021 at 11:32:16AM -0700, Axel Rasmussen wrote:

[...]

Not a native speaker, feel free to take anything I said with a grain of salt..

> @@ -278,14 +287,8 @@ by the current kernel version.
> (Since Linux 4.3.)
> Register a memory address range with the userfaultfd object.
> The pages in the range must be "compatible".
> -.PP
> -Up to Linux kernel 4.11,
> -only private anonymous ranges are compatible for registering with
> -.BR UFFDIO_REGISTER .
> -.PP
> -Since Linux 4.11,
> -hugetlbfs and shared memory ranges are also compatible with
> -.BR UFFDIO_REGISTER .
> +What constitutes "compatible" depends on the mode(s) being used, as described
> +below.

Would below be slightly better?

Please refer to the list of register modes below for the compatible memory
backends for each mode.

[...]

> @@ -735,6 +745,109 @@ or not registered with userfaultfd write-protect mode.
> .TP
> .B EFAULT
> Encountered a generic fault during processing.
> +.\"
> +.SS UFFDIO_CONTINUE
> +(Since Linux 5.13.)
> +Used for resolving minor faults specifically.
> +Take the existing page(s) in the range registered with
> +.B UFFDIO_REGISTER_MODE_MINOR
> +and install page table entries for them.

"Take the existing page" reads a bit weird to me. How about something like:
"Resolving minor-mode trapped page faults by installing page table entries with
pages in the page cache"?

[...]

> +.TP
> +.B EINVAL
> +An invalid bit was specified in the
> +.IR mode
> +field.
> +.TP
> +.B EEXIST
> +One or more pages were already mapped in the given range.

I'd think this sentence is good enough; slightly prefer dropping the latter one
"In other words..." below, as "mapped" should mean the same to me (and the
wording "fully mapped" is a bit confusing too..).

> +In other words, not only did pages exist in the page cache, but page table
> +entries already existed for those pages and they were fully mapped.

[...]

Thanks,

--
Peter Xu