Re: [PATCH v2 10/16] mm: multigenerational lru: mm_struct list

From: Matthew Wilcox
Date: Wed Apr 14 2021 - 10:39:13 EST


On Tue, Apr 13, 2021 at 12:56:27AM -0600, Yu Zhao wrote:
> In order to scan page tables, we add an infrastructure to maintain
> either a system-wide mm_struct list or per-memcg mm_struct lists.
> Multiple threads can concurrently work on the same mm_struct list, and
> each of them will be given a different mm_struct.
>
> This infrastructure also tracks whether an mm_struct is being used on
> any CPUs or has been used since the last time a worker looked at it.
> In other words, workers will not be given an mm_struct that belongs to
> a process that has been sleeping.

This seems like a great use for an allocating XArray. You can use a
search mark to indicate whether it's been used since the last time a
worker looked at it.