Re: [PATCH 6/6] sched/numa: Complete scanning of inactive VMAs when there is no alternative

From: Ingo Molnar
Date: Tue Oct 10 2023 - 17:39:58 EST



* Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> wrote:

> > 64 (BITS_PER_LONG) feels a bit small, especially on larger machines running
> > threaded workloads, and the kmalloc of numab_state likely allocates a full
> > cacheline anyway, so we could double the hash size from 8 bytes (2x1 longs)
^--- 16 bytes
> > to 32 bytes (2x2 longs) with very little real cost, and still have a long
> > field left to spare?
> >
>
> You're right, we could and it's relatively cheap. I would worry that as
> the storage overhead is per-VMA then workloads for large machines may
> also have lots of VMAs that are not necessarily using threads.

So I think there would be *zero* extra per-vma storage overhead, because
vma->numab_state is a pointer, with the structure kmalloc() allocated,
which should round the allocation to cacheline granularity anyway: 64 bytes
on NUMA systems that matter.

So with the current size of 'struct vma_numab_state' of 36 bytes, we can
extend it by 16 bytes with zero additional storage cost.

And since there's no cost, and less hash collisions are always good, the
change wouldn't need any other justification. :-)

[ Plus the resulting abstraction for the definition of a larger bitmask
would probably make future extensions easier. ]

But ... it was just a suggestion.

Thanks,

Ingo