On Mon, Dec 17, 2001 at 12:26:32PM -0800, John Tyner wrote: > > There is a trick: write a utility that allocates 350MB of memory and > > touches every 4k of it. That will force the kernel to shrink the > > caches. > > I'm curious (if this warrants an answer) what, in more detail, this causes > the kernel to do which causes the shrinking of the caches. I assume that > you're forcing the kernel to page out memory not in use in favor of the > memory allocated by this utility. The kernel uses a couple of LRU lists for the pages in use. The pages in your application are used more recent than the pages in the caches, so when the kernel tries to find more memory, it will shrink the caches instead of swapping out your application. (yes, I know this is an over-simplification of the VM subsystem) > Is something like this utility a good thing to run on a regular basis when > things like this happen? No, it doesn't any good to the kernel at all. It will only make *you* feel good. Note that the pages of *any* program will be newer than the pages in the caches, so every program will get the memory it asks for. > Is that 350MB number dependent on the amount of memory in the machine or is > it some magic number in the kernel? It's just a guess of mine. You have 384MB of memory in the system, so leaving about 30MB for the standard daemons would be enough. Erik -- J.A.K. (Erik) Mouw, Information and Communication Theory Group, Faculty of Information Technology and Systems, Delft University of Technology, PO BOX 5031, 2600 GA Delft, The Netherlands Phone: +31-15-2783635 Fax: +31-15-2781843 Email: J.A.K.Mouw@its.tudelft.nl WWW: http://www-ict.its.tudelft.nl/~erik/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ IRC Channel: irc.openprojects.net / #kernelnewbies Web Page: http://www.kernelnewbies.org/