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.