Here is a proposal to alter the choice of page to evict during pageout. The current implementation always chooses external pages if there any of those that are pageable. At the extreme case of that scenario, processes repeatedly page in and page out the same executable pages in order to progress, resulting in low performance.
This implementation now searches for pages in the order: inactive/external, inactive/internal, active/external and active/internal as suggested by Samuel (https://lists.gnu.org/archive/html/bug-hurd/2025-12/msg00034.html). The performance improvement is considerable. A test case involving 3 instances of g++ compiling C++ template code (MatrixSine.cpp from libeigen-dev) uses sufficient memory on a 4GB machine to require around 500MB of swap. This test takes about 11 minutes with previous gnumach version (using a virtual machine) but 3 minutes with this alteration. I have not been able to complete this test on a 64 bit Hurd 'real hardware' installation with previous gnumach but the compilation does complete with this patch after about 10 minutes. This patch compares quite well with my previous suggestion (https://lists.gnu.org/archive/html/bug-hurd/2025-12/msg00029.html). The test case took around 9 minutes on the hardware platform with that scheme, compared to about 10 minutes with this one. Times on virtual machines were very similar. I'd therefore recommend incorporating this patch rather than my previous offering. Although slightly slower, I believe it is an approach that will be longer lived, even though it will require further elaboration. I have a number of local prototypes that are compatible and which should improve performance further in the future. Also included is a minor enhancement to 'show vmstat' that also presents the portion of active and inactive pages that are external and internal.
