summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-12-26 11:43:42 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-12-26 11:43:42 +0100
commitdafd715743c710a07deb7cf2de58a0d0ab5a14a3 (patch)
treea08b6418c7274156db8ff23cfa309cb7fe4c0493
parent6fd655102eef5ec8b1e4e0b74c896eec3f9bac3b (diff)
downloadserenity-dafd715743c710a07deb7cf2de58a0d0ab5a14a3.zip
ProcFS: Fix inconsistent numbers in /proc/memstat
We were listing the total number of user/super pages as the number of "available" pages in the system. This was then misinterpreted in the SystemMonitor program and displayed wrong in the GUI.
-rw-r--r--Kernel/FileSystem/ProcFS.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp
index f959e59110..8740b44943 100644
--- a/Kernel/FileSystem/ProcFS.cpp
+++ b/Kernel/FileSystem/ProcFS.cpp
@@ -716,9 +716,9 @@ Optional<KBuffer> procfs$memstat(InodeIdentifier)
json.add("kmalloc_available", (u32)sum_free);
json.add("kmalloc_eternal_allocated", (u32)kmalloc_sum_eternal);
json.add("user_physical_allocated", MM.user_physical_pages_used());
- json.add("user_physical_available", MM.user_physical_pages());
+ json.add("user_physical_available", MM.user_physical_pages() - MM.user_physical_pages_used());
json.add("super_physical_allocated", MM.super_physical_pages_used());
- json.add("super_physical_available", MM.super_physical_pages());
+ json.add("super_physical_available", MM.super_physical_pages() - MM.super_physical_pages_used());
json.add("kmalloc_call_count", g_kmalloc_call_count);
json.add("kfree_call_count", g_kfree_call_count);
slab_alloc_stats([&json](size_t slab_size, size_t num_allocated, size_t num_free) {