2022-06-22 14:20:21 +02:00
|
|
|
---
|
2022-12-15 12:03:35 +01:00
|
|
|
free.1 | 2 +-
|
2022-06-22 14:20:21 +02:00
|
|
|
proc/sysinfo.c | 9 +++++----
|
2022-12-15 12:03:35 +01:00
|
|
|
2 files changed, 6 insertions(+), 5 deletions(-)
|
2022-06-22 14:20:21 +02:00
|
|
|
|
2022-12-15 12:03:35 +01:00
|
|
|
--- free.1
|
|
|
|
+++ free.1 2022-12-15 09:40:32.807087343 +0000
|
|
|
|
@@ -19,7 +19,7 @@ columns are:
|
|
|
|
Total installed memory (MemTotal and SwapTotal in /proc/meminfo)
|
|
|
|
.TP
|
|
|
|
\fBused\fR
|
|
|
|
-Used memory (calculated as \fBtotal\fR - \fBfree\fR - \fBbuffers\fR - \fBcache\fR)
|
|
|
|
+Used memory (calculated as \fBtotal\fR - \fBavailable\fR)
|
|
|
|
.TP
|
|
|
|
\fBfree\fR
|
|
|
|
Unused memory (MemFree and SwapFree in /proc/meminfo)
|
2022-06-22 14:20:21 +02:00
|
|
|
--- proc/sysinfo.c
|
|
|
|
+++ proc/sysinfo.c 2022-06-22 11:29:39.240066488 +0000
|
|
|
|
@@ -794,10 +794,6 @@ nextline:
|
|
|
|
where such values will be dramatically distorted over those of the host. */
|
|
|
|
if (kb_main_available > kb_main_total)
|
|
|
|
kb_main_available = kb_main_free;
|
|
|
|
- mem_used = kb_main_total - kb_main_free - kb_main_cached - kb_main_buffers;
|
|
|
|
- if (mem_used < 0)
|
|
|
|
- mem_used = kb_main_total - kb_main_free;
|
|
|
|
- kb_main_used = (unsigned long)mem_used;
|
|
|
|
|
|
|
|
/* zero? might need fallback for 2.6.27 <= kernel <? 3.14 */
|
|
|
|
if (!kb_main_available) {
|
|
|
|
@@ -821,6 +817,11 @@ nextline:
|
|
|
|
kb_main_available = kb_main_free;
|
|
|
|
#endif /* linux */
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ mem_used = kb_main_total - kb_main_available;
|
|
|
|
+ if (mem_used < 0)
|
|
|
|
+ mem_used = kb_main_total - kb_main_free;
|
|
|
|
+ kb_main_used = (unsigned long)mem_used;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************/
|