I would like to deploy the following swapping policy:
- By default all pages in memory should also be in swap space.
- When a page in memory is changed (i.e. dirty), the page should be written out as soon as possible, but with lower priority than other processes.
- if a certain configurable watermark is reached, (let's say 80% of pages are dirty), the priority will be equal as other processes.
Is this kind of swapping policy possible with the linux kernel? If so, how do I set the kernel settings to achieve this?
Obviously the reason for this is to reduce the number of pages that need to be swapped out. Only dirty pages need to be written to disk, and this happens in the background over time. Therefore when page misses occur (i.e. the page is not in memory), there is no need to write any pages from memory to disk, but only from disk to memory. Therefore it reduced the probability of i/o bottlenecks because both swapping in and swapping out try to access the disk simultaneously.