From dafd715743c710a07deb7cf2de58a0d0ab5a14a3 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 26 Dec 2019 11:43:42 +0100 Subject: [PATCH] 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. --- Kernel/FileSystem/ProcFS.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index f959e591104..8740b449433 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -716,9 +716,9 @@ Optional 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) {