Bugzilla – Bug 155309
sysinfo kioslave free memory report should be changed
Last modified: 2006-03-06 10:27:37 UTC
The free memory reported by the sysinfo kioslave (since Beta 6 it gained great visibility because it has become "My Computer" homepage) has the potential to stir up the old frequently asked questions from newbies: «why does my Linux reports so little free memory?», «why is Linux eating all my RAM when I don't have any application open?», etc. In order to avoid endless amounts of emails sent to Support and to forums, this confusion could be prevented if the free memory reported by sysinfo:/ does not to include memory used by cache and buffers (as reported by /proc/meminfo).
hmm, then we get bug reports that say our information about free memory is wrong ;( Here is my workstation's memory: Mem: 513840k total, 415460k used, 98380k free, 66220k buffers Swap: 1020088k total, 123964k used, 896124k free, 144064k cached So you could add free+buffers+cached and declare that as "free", but as a matter of fact, that's not exactly free as if you invalidate caches your system won't be the same as before. But then again, 22mb free memory on my laptop are just very wrong: Mem: 1035408k total, 1017820k used, 17588k free, 61504k buffers Swap: 1967920k total, 24k used, 1967896k free, 741224k cached Both use a very similiar amount of memory - so in some sense the laptop has more memory free. I'm undecided - especially as we're way behind message freeze, so my only two options are leaving out this value at all or redefining "free memory" as +cached+buffers. Any other opinions?
I don't think you can really win here given that most of the values don't make sense for Joe User. Total is ok, used includes buffers/caches so it's confusing for Joe User, similar for free, buffers is uninteresting and cached is actually wrong. Maybe the best solution would be to say "Free : X ( Y )", where X is free+buffers+cached and Y is just free. That way everybody should be happy they see their favourite nonsensical number there ;) .
I might play with a graphical representation - your X (Y) looks confusing, especially as this HTML page has no mentioning in the documentation.
the result would still be wrong. at least add slab caches as well.
I would experiment with a horrible hack: Make the amount of "free" memory presented to the user be free+buffers+cache-{20-50}MB . I would not add slab memory, as that one is not easily freed (only by actually using less objects, like files, sockets, processes and so on), unlike buffers/cache which can just be discarded (and is). The rationale for the 20-50 MB offset is that the system tend to use that amount as minimum buffers/cache, as soon as it stopped swapping in again in a nearly-oom situation. What I mean here: Create a mem-eater program, use it to reduce all buffers/cache to a minimum. That will also swap out stuff, or discard mapped read-only pages. When it's done, wait a bit and touch all user programs (by clicking each program window once, which is what Joe user would do if asked to somehow "activate" all programs once). Then look at the amount of buffers/cache. It won't be very high, but that's the amount which in effect is "used by the system". Depending on an uncountable number of circumstances this amount will vary, but 20 to 50 MB is IMHO a good approximation of it. Yes, that's an illogical algorithm, but IMHO it would give sensible numbers without showing unrealistically high free-mem values.
thanks everyone for the input. I added a sum of all three ;) 1. on my laptop the slabs cache counted up to 350MB before I discarded it with a fork bomb, so I counted that in as discardable. 2. I remove 50MB of the caches for the system to have without calling it free 3. the display looks now on my laptop (see #1) Free: 17.5MB (+890MB) We might need to change it to display Used memory in the future ;)