lkml.org 
[lkml]   [2021]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Why is Shmem included in Cached in /proc/meminfo?
From
Date
[add linux-mm mailing list]

On 8/30/21 12:44 AM, Mikko Rantalainen wrote:
> 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;
>


--
~Randy

\
 
 \ /
  Last update: 2021-08-30 16:36    [W:0.062 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site