Re: [PATCH v3 04/27] mm/userfaultfd: Introduce special pte for unmapped file-backed mem
From: Hugh Dickins
Date: Thu Jun 03 2021 - 23:15:49 EST
On Fri, 4 Jun 2021, Alistair Popple wrote:
>
> The detail which is perhaps less important is whether to implement this using
> a new swap entry type or arch-specific swap bit. The argument for using a swap
> type is it will work across architectures due to the use of pte_to_swp_entry()
> and swp_entry_to_pte() to convert to and from the arch-dependent and
> independent representations.
>
> The argument against seems to have been that it is wasting a swap type.
> However if I'm understanding correctly that's not true for all architectures,
> and needing to reserve a bit is more wasteful than using a swap type.
I'm on the outside, not paying much attention here,
but thought Peter would have cleared this up already.
My understanding is that it does *not* use an additional arch-dependent
bit, but puts the _PAGE_UFFD_WP bit (already set aside by any architecture
implementing UFFD WP) to an additional use. That's why I called this
design (from Andrea) more elegant than mine (swap type business).
If I've got that wrong, and yet another arch-dependent bit is needed,
then I very much agree with you: finding arch-dependent pte bits is a
much tougher job than another play with swap type.
(And "more elegant" might not be "easier to understand": you decide.)
Hugh