It is tunable viasysctl -d vm.swap_idle_{enabled,threshold{1,2}}
From RTFM tuning(7): TheCode:vm.swap_idle_enabled: Allow swapout on idle criteria vm.swap_idle_threshold1: Guaranteed swapped in time for a process vm.swap_idle_threshold2: Time before a process will be swapped out
vm.swap_idle_enabled
sysctl is useful in large multi-user systems where you have lots of users entering and leaving the system and lots of idle processes. Such systems tend to generate a great deal of continuous pressure on free memory reserves. Turning this feature on and adjusting the swapout hysteresis (in idle seconds) viavm.swap_idle_threshold1
andvm.swap_idle_threshold2
allows you to depress the priority of pages associated with idle processes more quickly then the normal pageout algorithm. This gives a helping hand to the pageout daemon. Do not turn this option on unless you need it, because the tradeoff you are making is to essentially pre-page memory sooner rather than later, eating more swap and disk bandwidth. In a small system this option will have a detrimental effect but in a large system that is already doing moderate paging this option allows the VM system to stage whole processes into and out of memory more easily.
Thanks i will hold hands up and say I didnt know about that one
Great news it exists.