On Mon, Jul 29, 2019 at 11:22:16AM -0400, Waiman Long wrote: > On 7/29/19 10:27 AM, Peter Zijlstra wrote: > > Also; why then not key off that owner tracking to free the resources > > (and leave the struct mm around) and avoid touching this scheduling > > hot-path ? > > The resources are pinned by the reference count. Making a special case > will certainly mess up the existing code. > > It is actually a problem for systems that are mostly idle. Only the > kernel->kernel case needs to be updated. If the CPUs isn't busy running > user tasks, a little bit more overhead shouldn't really hurt IMHO. But when you cannot find a new owner; you can start to strip mm_struct. That is, what's stopping you from freeing swap reservations when that happens? That is; I think the moment mm_users drops to 0, you can destroy the actual addres space. But you have to keep mm_struct around until mm_count goes to 0. This is going on the comments with mmget() and mmgrab(); they forever confuse me.