From: "Theo de Raadt" Subject: Re: Faster _exit(2) for a faster userland: R.I.P the reaper To: Ted Unangst , dlg@openbsd.org, visa@openbsd.org, tech@openbsd.org, jan@openbsd.org, mpi@grenadille.net, ajacoutot@openbsd.org Date: Sat, 03 May 2025 08:05:22 -0600 I think the way forward is to write a uvmspace_purge function which removes all (most?) userland mappings, and is called from an earlier point in exit1(), when we can still sleep. It leaves the map data structure live and consistant, just without any mappings. That results in the map being as empty as possible. It probably copes some of the top code inside uvm_map_teardown() (20 years of worrying about pmemrange contention has resulted in a different form of contention hurting instead). The proposal is that the reaper sequence does not get changed at this point. However now the reaper will be faster because the map is has fewer resources to return. This is the first step, mappings removal in exiting-process context, and NO CHANGES to the reaper or process sequencing. Once that works, the next step is probably to ensure the purge function also cleans up the pmap resources correctly, in process context. When that works, uvmspace_free/uvm_map_teardown probably is changed to assert the user map / user pmap is actually empty. Then the optimizations can begin.