diff options
author | Matthew Ahrens <[email protected]> | 2020-07-16 10:11:26 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-16 10:11:26 -0700 |
commit | 8fbf432ae274fc227c38012230c3bf23bda64d64 (patch) | |
tree | eb7643394eb1792f702b6d7b5aed71a6708e2fcd /module | |
parent | 23c871671c7bc2c79ad6ec1804715f405058cdb6 (diff) |
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 <[email protected]>
Reviewed-by: Pavel Zakharov <[email protected]>
Reviewed-by: George Wilson <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Matthew Ahrens <[email protected]>
Closes #10575
Diffstat (limited to 'module')
-rw-r--r-- | module/os/linux/zfs/arc_os.c | 1 |
1 files changed, 0 insertions, 1 deletions
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 */ } |