On Friday, 4 June 2021 1:14:31 PM AEST Hugh Dickins wrote: > 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). 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