NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Using swap though there's plenty of mem free




Warning: speculation below.

On Sun, 4 May 2008, Jonathan Schleifer wrote:

Memory: 171M Act, 90M Inact, 2120K Wired, 22M Exec, 23M File, 63M Free
Swap: 257M Total, 63M Used, 194M Free

63 MB RAM unused. Not even for file cache. And still 63 MB swapped out?

I'll be the first to admit I don't know how the VM system in NetBSD works. But are you _sure_ that those 63 megs really aren't still in memory?


They could be paged out to disk, and a copy kept in RAM, but marked available for use (hence they are "free"). I believe this is the way you normally set up a virtual memory system, with a category for recently paged out but still-in-memory (cached) pages.

This would mean that if you need to access those pages, there is no cost since they are already available without going to the disk. But if you need more memory than what is free, they will be reclaimed first, since they are already written to disk and no I/O is needed.

(If nothing ever requests more memory than what is free, then the pages will not be overwritten, and will stay cached.)


And that would be the difference between "inactive" and "free" -- but thinking about it, it's probably "inactive" that does what I described, and "free" is really free.

(And if it's really free, and the numbers are relatively stable over time, you could choose to use the memory for something useful. Like... a larger file cache?)


Again, I'm not sure if this exactly how things work. (I am pretty sure that some of the details are wrong.) But the general idea is probably something similar to this. And sorry about the lecture.


MAgnus



Home | Main Index | Thread Index | Old Index