Thread (60 messages) 60 messages, 4 authors, 2021-07-08

Re: [PATCH v3 04/27] mm/userfaultfd: Introduce special pte for unmapped file-backed mem

From: Alistair Popple <apopple@nvidia.com>
Date: 2021-06-04 06:16:39
Also in: lkml

On Friday, 4 June 2021 1:14:31 PM AEST Hugh Dickins wrote:
On Fri, 4 Jun 2021, Alistair Popple wrote:
quoted
The detail which is perhaps less important is whether to implement this 
using
quoted
a new swap entry type or arch-specific swap bit. The argument for using a 
swap
quoted
type is it will work across architectures due to the use of 
pte_to_swp_entry()
quoted
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,
quoted
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).
Oh my bad, I had somehow missed this was reusing an *existing* arch-dependent 
swap bit (_PAGE_SWP_UFFD_WP, although the same argument could apply) even 
though it's in the commit message. Obviously I should have read that more 
carefully, apologies for the noise but thanks for the clarification.
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.)
Agree, that's a somewhat subjective debate. Conceptually I don't think this is 
particularly difficult to understand. It just adds another slightly different 
class of special swap pte's to know about.

 - Alistair
Hugh



Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help