Re: [PATCH 1/4] mm: introduce 'encoded' page pointers with embedded extra bits

From: Linus Torvalds
Date: Tue Nov 08 2022 - 15:47:27 EST


On Tue, Nov 8, 2022 at 12:37 PM Nadav Amit <nadav.amit@xxxxxxxxx> wrote:
>
> > +static inline bool encoded_page_flags(struct encoded_page *page)
> > +{
> > + return ENCODE_PAGE_BITS & (unsigned long)page;
> > +}
>
> I think this one wants to be some unsigned, as otherwise why have
> ENCODE_PAGE_BITS as 3ul ?

Right you are. That came from my old old version where this was just
"bool dirty".

Will fix.

Doesn't matter for the TLB flushing case, but I really did hope that
we could use this for mlock too, and that case needs both bits.

I did look at converting mlock (and it's why I wanted to make
release_pages() take that whole encoded thing in general, rather than
make some special case for it), but the mlock code uses that "struct
pagevec" abstraction that seems entirely pointless ("pvec->nr" becomes
"pagevec_count(pvec)", which really doesn't seem to be any clearer at
alll), but whatever.

Linus