[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5a42eb2b-fd7b-6296-f5d6-619661ad1418@peda.net>
Date: Mon, 30 Aug 2021 10:44:44 +0300
From: Mikko Rantalainen <mikko.rantalainen@...a.net>
To: linux-kernel@...r.kernel.org
Subject: Why is Shmem included in Cached in /proc/meminfo?
It's not immediately obvious from fs/proc/meminfo.c function
meminfo_proc_show() but the output of Cached: field seems to always
include all of Shmem: field, too.
Is this intentional? Usually cache is something that can be discarded if
needed but shared memory (e.g. used to contain files in tmpfs) cannot be
discarded without a data-loss. As such, I'd argue that it shouldn't be
included in the Cached: output.
A simple fix could be
- cached = global_node_page_state(NR_FILE_PAGES) -
- total_swapcache_pages() - i.bufferram;
+ cached = global_node_page_state(NR_FILE_PAGES) -
+ total_swapcache_pages()
+ - i.bufferram - i.sharedram;
--
Mikko
Powered by blists - more mailing lists