Re: [PATCH 02/16] mm: introduce leaf entry type and use to simplify leaf entry logic

From: Lorenzo Stoakes

Date: Wed Nov 05 2025 - 12:34:38 EST


On Wed, Nov 05, 2025 at 01:21:15PM -0400, Jason Gunthorpe wrote:
> On Wed, Nov 05, 2025 at 09:42:24AM -0500, Gregory Price wrote:
> > On Mon, Nov 03, 2025 at 12:31:43PM +0000, Lorenzo Stoakes wrote:
> > > +typedef swp_entry_t leaf_entry_t;
> > > +
> > > +#ifdef CONFIG_MMU
> > > +
> > > +/* Temporary until swp_entry_t eliminated. */
> > > +#define LEAF_TYPE_SHIFT SWP_TYPE_SHIFT
> > > +
> > > +enum leaf_entry_type {
> > > + /* Fundamental types. */
> > > + LEAFENT_NONE,
> > > + LEAFENT_SWAP,
> > > + /* Migration types. */
> > > + LEAFENT_MIGRATION_READ,
> > > + LEAFENT_MIGRATION_READ_EXCLUSIVE,
> > > + LEAFENT_MIGRATION_WRITE,
> > > + /* Device types. */
> > > + LEAFENT_DEVICE_PRIVATE_READ,
> > > + LEAFENT_DEVICE_PRIVATE_WRITE,
> > > + LEAFENT_DEVICE_EXCLUSIVE,
> > > + /* H/W posion types. */
> > > + LEAFENT_HWPOISON,
> > > + /* Marker types. */
> > > + LEAFENT_MARKER,
> > > +};
> > > +
> >
> > Have been browsing the patch set again, will get around a deeper review,
> > but just wanted to say this is a thing of beauty :]
>
> +1 I thought the same thing. So much clearer what is going on here,
> and I didn't realize we had so many types already..
>
> Jason

Thank you both guys much appreciated :)

Obviously heavily influenced by your great feedback, but I really did try to
build it in a way that tried to simplify as much as possible.

Cheers, Lorenzo