I noticed that the paging starts only when the number in the free queue of pages is less than vm_page_free_min and continues until it reaches free_target. Variable vm_page_free_target is set via macro VM_PAGE_FREE_TARGET.
#ifndef VM_PAGE_FREE_MIN #define VM_PAGE_FREE_MIN(free) (10 + (free) / 100) #endif /* VM_PAGE_FREE_MIN */ # Ifndef VM_PAGE_FREE_TARGET # define VM_PAGE_FREE_TARGET (free) (15 + (free) / 80) # endif / * If we assume that the free 2 GB of memory, then vm_page_free_targe about 25 mb. In the linux kernel swapping start to work actively, when free memory is 20-25% of total RAM. I think that macros VM_PAGE_FREE_TARGET VM_PAGE_FREE_MIN should be changed. This patch modifies these macros: diff -u -r gnumach//vm/vm_pageout.c gnumach2//vm/vm_pageout.c --- gnumach//vm/vm_pageout.c 2010-04-18 23:00:18.862962394 +0600 +++ gnumach2//vm/vm_pageout.c 2010-04-18 23:02:16.270982611 +0600 @@ -97,7 +97,7 @@ */ #ifndef VM_PAGE_FREE_TARGET -#define VM_PAGE_FREE_TARGET(free) (15 + (free) / 80) +#define VM_PAGE_FREE_TARGET(free) (15 + (free) / 5) #endif /* VM_PAGE_FREE_TARGET */ /* @@ -106,7 +106,7 @@ */ #ifndef VM_PAGE_FREE_MIN -#define VM_PAGE_FREE_MIN(free) (10 + (free) / 100) +#define VM_PAGE_FREE_MIN(free) (10 + (free) / 6) #endif /* VM_PAGE_FREE_MIN */ /* When vm_page_external_count exceeds vm_page_external_limit, Now paging will start earlier.