Re: [PATCH] mm/mempolicy: refcount the weighted interleave state instead of copying it

From: Gregory Price

Date: Mon Aug 24 2026 - 11:18:14 EST


On Sun, Aug 23, 2026 at 11:52:55PM -0400, Gregory Price wrote:
> On Mon, Aug 24, 2026 at 04:06:03AM +0100, Matthew Wilcox wrote:
> > On Sun, Aug 23, 2026 at 10:41:17PM -0400, Gregory Price wrote:
> >
> > Bit of a shame to take/put a refcount on every memory allocation. That
> > seems like it might hurt (even being on a different cacheline). Would
> > it make more sense to use SRCU for this?
>
> Bulk allocation - from some measurements it's about once per 100-pages
> on average. Looking back at the data I was getting about 41 refs per
> 4096 pages (16MB chunks).
>
> Have to imagine there's other cache fighting in that stack too.
>
> I'm less familiar with the rules around SRCU so i shied away from it,
> but I will take a look.
>

I will update to the new fast srcu mechanism, but it'll prevent
backporting beyond 6.18.

Best to backport the gfp fix and update to srcu in normal cadence.

Will submit separately.

~Gregory