Re: [PATCH v2] x86,mm: only trim the mm_cpumask once a second

Dave Hansen
2024-12-04T00:46:34Z

On 12/3/24 12:07, Rik van Riel wrote:
> The tlb_flush2 threaded test does not only madvise in a
> loop, but also mmap and munmap from inside every thread.
>
> This should create massive contention on the mmap_lock,
> resulting in threads going to sleep while waiting in
> mmap and munmap.
>
> https://github.com/antonblanchard/will-it-scale/blob/master/tests/tlb_flush2.c

Oh, wow, it only madvise()'s a 1MB allocation before doing the
munmap()/mmap(). I somehow remembered it being a lot larger. And, yeah,
I see a ton of idle time which would be 100% explained by mmap_lock
contention.

Did the original workload that you care about have idle time?

I'm wondering if trimming mm_cpumask() on the way to idle but leaving it
alone on a context switch to another thread is a good idea.