From ee150cd8b4fc4b1aba5d456e7791bc5366917568 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 6 Mar 2024 14:00:33 +0100 Subject: procfs: fix MemTotal 4G memory clamp on 32bit systems Using vmstats allows to get up to 16T. --- procfs/rootdir.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/procfs/rootdir.c b/procfs/rootdir.c index 7742eddc..35af7546 100644 --- a/procfs/rootdir.c +++ b/procfs/rootdir.c @@ -315,7 +315,10 @@ rootdir_gc_meminfo (void *hook, char **contents, ssize_t *contents_len) "Inactive: %14lu kB\n" "Mlocked: %14lu kB\n" , - (long unsigned) hbi.memory_size / 1024, + (long unsigned) (vmstats.free_count + + vmstats.active_count + + vmstats.inactive_count + + vmstats.wire_count) * PAGE_SIZE / 1024, (long unsigned) vmstats.free_count * PAGE_SIZE / 1024, 0UL, (long unsigned) cache_stats.cache_count * PAGE_SIZE / 1024, -- cgit v1.2.3