Why would some process swap in place of reclaiming free(cached) memory
Mulyadi Santosa
mulyadi.santosa at gmail.com
Thu Feb 21 22:36:41 EST 2013
On Wed, Feb 20, 2013 at 10:01 PM, Soham Chakraborty
<sohamwonderpiku4u at gmail.com> wrote:
> The question is salivating and simple. When we have free and lotsa cached
> memory in a system (irrespective of distro and kernel), why would some
> process end up in swap space, I understand the overcommit mode of vm, the
> default value of 0 and what it does. I also know that the cache might be
> dirty and we don't might not want to allocate free pages thinking that we
> might go under the watermark of low. But, I mainly end up getting this
> question from end users - why would things swap if I have free memory.
I support michael's answer. basically because those (anonymous) pages
are inactive for quite long time. So instead of letting them sit in
RAM for nothing, they are swapped out.
IMHO, it is better to do this earlier than waiting for free RAM
getting tighter and doing swap out right at the moment some apps hit
page fault and swapping out inactive pages. If we did this way, memory
allocation will go slow (maybe really slow).
> Any reference to source where it gives the condition to transfer some pages
> to swap, despite of having free memory, would be highly appreciated.
i think it's in mm/vmscan.c
>I tried
> to find in mm/vmscan.c but didn't get much success.
really? hmm I remember there are codes there that scan inactive pages
and swap them out.
--
regards,
Mulyadi Santosa
Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
More information about the Kernelnewbies
mailing list