[Gllug] Memory usage when idle

Daniel P. Berrange dan at berrange.com
Wed May 5 15:46:05 UTC 2004


On Wed, May 05, 2004 at 01:54:37PM +0100, Andy Farnsworth wrote:
> -----Original Message-----
> From: Behalf Of Daniel P. Berrange
> Sent: Wednesday, May 05, 2004 12:55 PM
> To: Greater London Linux Users Group
> Subject: Re: [Gllug] Memory usage when idle
> 
> Is this including or excluding the mmemory used by the kernel disk cache
> the kernel will tend to use all available memory to cache pages from the
> disk to maximise I/O performance[1]
> 
> [1] Of course this doesn't always go to plan because maximising
>     I/O performance in this way impacts on applications responsiveness
>     as they get swapped in/out....
> 
> -----End Original Message-----
> 
> The Linux kernel uses almost all available memory (it will leave
> something like 8-16 Mb free) to cache pages from the disk to maximize
> I/O performance, however, it will not do so to an extent that it will
> cause swap.  These memory pages are flagged as purgable from memory and
> therefore if an application needs more memory than is currently
> available, the flagged memory pages will be purged (and the disk cache
> thus reduced) to allow the application the memory it needs.  This is a
> very intelligent way of fully utilizing the resources available on the
> machine without causing unwanted slowdown when more memory is needed.

The kernel will, however, quite happily swap out applications which are
currently idle in order to increase the disk cache size. The classic 
scenario is coming back to use a machine in the morning after the slocate
database has been updated overnight - it can take a long time to swap
back in all the applications. If the kernel had only used 50% as much
memory for disk cache, the slocate update would have had no appreciable
slowdown & the system would have been much quicker to wake up in the
morning.

In 2.6 kernels a 'swappiness' knob was introduced to /proc to try and
balance these needs. Further patches were later written to automatically
tune swappiness to suit the current workload. Its all very interesting...

  http://kerneltrap.org/node/view/1044

Dan.
-- 
|=-               http://www.berrange.com/~dan/gpgkey.txt             -=|
|=-   berrange at redhat.com  -  Daniel Berrange  -  dan at berrange.com    -=|
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20040505/5a3e3c1d/attachment.pgp>
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list