From 8fbf432ae274fc227c38012230c3bf23bda64d64 Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Thu, 16 Jul 2020 10:11:26 -0700 Subject: anon_pages are not free/evictable `arc_free_memory()` returns the amount of memory that the ARC considers to be free. This includes pages that are not actually free, but can be evicted with essentially zero cost (without doing any i/o), for example the page cache. The ARC can "squeeze out" any pages included in this calculation, leaving only `arc_sys_free` (1/64th of RAM) for these free/evictable pages. Included in the count of free/evictable pages is `nr_inactive_anon_pages()`, which is described as "Anonymous memory that has not been used recently and can be swapped out". These pages would have to be written out to disk (swap) in order to evict them, and they are not included in `/proc/meminfo`'s `MemAvailable`. Therefore it is not appropriate for `nr_inactive_anon_pages()` to be included in the free/evictable memory returned by `arc_free_memory()`, because the ARC shouldn't (intentionally) make the system swap. This commit removes `nr_inactive_anon_pages()` from the memory returned by `arc_free_memory()`. This is a step towards enabling the ARC to manage free memory by monitoring it and reducing the ARC size as we notice that there is insufficient free memory (in the `arc_reap_zthr`), rather than the current method of relying on the `arc_shrinker` callback. Reviewed-by: Tony Nguyen Reviewed-by: Pavel Zakharov Reviewed-by: George Wilson Reviewed-by: Brian Behlendorf Signed-off-by: Matthew Ahrens Closes #10575 --- module/os/linux/zfs/arc_os.c | 1 - 1 file changed, 1 deletion(-) (limited to 'module/os') diff --git a/module/os/linux/zfs/arc_os.c b/module/os/linux/zfs/arc_os.c index b7a471c2f..2a119d4e8 100644 --- a/module/os/linux/zfs/arc_os.c +++ b/module/os/linux/zfs/arc_os.c @@ -100,7 +100,6 @@ arc_free_memory(void) #else return (ptob(nr_free_pages() + nr_inactive_file_pages() + - nr_inactive_anon_pages() + nr_slab_reclaimable_pages())); #endif /* CONFIG_HIGHMEM */ } -- cgit v1.2.3