Here is a series of patches that improves performance during periods of swap activity. The current implementation only chooses internal pages when there are no external pages that can be paged out. The patches are each intentionally small for simpler review. In summary:
1) vm_page now supports explicit selection of internal or external pages for eviction. The code previously returned external pages unless there were only internal ones available. 2) vm_page now counts the number of pages of each type separately rather than just the sum of all active or inactive pages. 3) vm_page_evict_once now considers what proportion of all pageable pages are external and once it reaches a low threshold then internal pages become preferred. The performance improvements were observed using g++ compilation processes that were large enough for a 4GB virtual machine to require approximately 500M of swap usage. Real elapsed times were reduced from around 11 minutes to 3 minutes. Whilst this scenario does not represent all possible performance scenarios, I felt it to be representative of a realistic task that a Hurd machine might run. I have previously mentioned how primitive this algorithm is. I would not expect this simple scheme to be long lived but rather it can illustrate the advantages of being more particular about which page is selected for eviction during pageout. Further improvements should be expected. Regards, Mike.
