mtchang / rt-n56u

Automatically exported from code.google.com/p/rt-n56u
0 stars 0 forks source link

Fix free and free mem display in web interface #931

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The problem is that the busybox free doesn't show
+/- buffers/cache:
but only
+/- buffers:

When the Linux kernel is caching a lot of stuff in memory the "free" memory 
will be displayed only with buffers subtracted, but not cache, so the number is 
off by quite a lot of MB.

The web interface seems to show free memory with buffers and cache included, so 
the number is even smaller than in busybox free.

Example:
Web interface says 11.75 MB free

free outputs:
             total    used    free  shared  buffers
Mem:        126404  114380   12024       0     2124
-/+ buffers:        112256   14148

cat /proc/meminfo outputs:
MemTotal:         126404 kB
MemFree:           11984 kB
Buffers:            2124 kB
Cached:            91796 kB
...

So real free (as in usable by processes) memory is MemFree + Buffers + Cached = 
about 103 MB.

By the way, a simple
echo 3 > /proc/sys/vm/drop_caches
clears the caches. So for a short time the web interface will show a more or 
less accurate number until the cache grows again.

Original issue reported on code.google.com by xno...@gmail.com on 2 Aug 2013 at 2:34

GoogleCodeExporter commented 9 years ago
Web interface used data from /proc/meminfo. See function get_memdata in 
user/httpd/web_ex.c

Original comment by andy.pad...@gmail.com on 3 Aug 2013 at 10:12

GoogleCodeExporter commented 9 years ago
Yes, I was referring to the overview on the start page where it says load avg, 
cpu load, mem free, uptime.

Wouldn't it make more sense to add buffers and caches to "mem free"?

Original comment by xno...@gmail.com on 3 Aug 2013 at 9:36

GoogleCodeExporter commented 9 years ago
You can enable USB Application - Common setting - Automatic I/O RAM caches 
reclaim.

Auto-reclaim free pagecache (to needed ratio) on any buffered I/O operations.

Original comment by andy.pad...@gmail.com on 11 Aug 2013 at 6:25

GoogleCodeExporter commented 9 years ago

Original comment by Dr.Sydorenko.O on 1 Sep 2013 at 1:59