title: What are the exact conditions based on which Linux swaps process(s) memory from RAM to a swap file?
body: <p>My server has 8Gigs of RAM and 8Gigs configured for swap file. I have memory intensive apps running. These apps have peak loads during which we find swap usage increase. Approximately 1 GIG of swap is used. </p>
  
  <p>I have another  server with 4Gigs of RAM and 8 Gigs of swap and similar memory intensive apps running on it. But here swap usage is very negligible. Around 100 MB.</p>
  
  <p>I was wondering what are the <strong>exact</strong> conditions or a <strong><em>rough formula</em></strong> based on which Linux will do a swapout of a process memory in RAM to the swap file.
  I know its based on swapiness factor. What else is it based on? Swap file size? Any pointers to Linux kernel documentation/source code explaining this will be great.</p>