Re: [PATCH v2 4/5] mm: make vma cache SLAB_TYPESAFE_BY_RCU

From: Matthew Wilcox
Date: Wed Nov 13 2024 - 08:58:56 EST


On Wed, Nov 13, 2024 at 07:38:02AM -0500, Liam R. Howlett wrote:
> > Hi, I was wondering if we actually need the detached flag. Couldn't
> > "detached" simply mean vma->vm_mm == NULL and we save 4 bytes? Do we ever
> > need a vma that's detached but still has a mm pointer? I'd hope the places
> > that set detached to false have the mm pointer around so it's not inconvenient.
>
> I think the gate vmas ruin this plan.

But the gate VMAs aren't to be found in the VMA tree. Used to be that
was because the VMA tree was the injective RB tree and so VMAs could
only be in one tree at a time. We could change that now!

Anyway, we could use (void *)1 instead of NULL to indicate a "detached"
VMA if we need to distinguish between a detached VMA and a gate VMA.