>How is it even remotely possible that turning off swap restores memory
>shared between processes? Is the Linux kernel going from process to process
>comparing pages of memory as they re-enter RAM? "Oh, those two look
>identical, they'll get shared?"

This is a good point.  I really have no clue how the kernel deals with 
swapping/sharing, so I can only speculate.  I could imagine that it's 
possible for it to do this, if the pages are marked properly, they could be 
restored.  But, I'll admit, it seems unlikely.

...and, I had this thought before.  Maybe this apparent loss of shared 
memory is an illusion.  It appears to make the amount of memory that the 
httpds use grow very high, but perhaps it is a kind of shared-swap, and 
thus the calculation I'm using to determine overall memory usage would need 
to also factor out swap.  ...in which case, there's no problem at all.

But, I do see an albeit qualitative performance increase and CPU load 
lowering when I get the httpds to stay shared (and unswapped).  So, I think 
it does matter.

Though, if you think about it, it sort of makes sense.  Some portion of the 
shared part of the httpd is also not being used much, so it gets swapped 
out to disk.  But, if those pages really aren't being used, then there 
shouldn't be a performance hit.  If they are being used, then they'd get 
swapped back in.

...which sort of disproves my qualitative reasoning that swap/unshared is bad.

my head hurts, maybe I should join a kernel mailing list and see is someone 
there can help me (and if I can understand them).

-bill



Reply via email to