Skip to content

Commit db290fd

Browse files
amotintonyhutter
authored andcommitted
Linux: Stop using NR_FILE_PAGES for ARC scaling
I've found that QEMU/KVM guest memory accounted as shared also included into NR_FILE_PAGES. But it is actually a non-evictable anonymous memory. Using it as a base for zfs_arc_pc_percent parameter makes ARC to ignore shrinker requests while page cache does not really have anything to evict, ending up in OOM killer killing the QEMU process. Instead use of NR_ACTIVE_FILE + NR_INACTIVE_FILE should represent the part of a page cache that is actually evictable, which should be safer to use as a reference for ARC scaling. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ameer Hamza <[email protected]> Reviewed-by: Pavel Snajdr <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc. Closes #17334 (cherry picked from commit 0aa83dc)
1 parent a2bcf19 commit db290fd

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

include/os/linux/kernel/linux/page_compat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
/*
55
* Create our own accessor functions to follow the Linux API changes
66
*/
7-
#define nr_file_pages() global_node_page_state(NR_FILE_PAGES)
8-
#define nr_inactive_anon_pages() global_node_page_state(NR_INACTIVE_ANON)
7+
#define nr_file_pages() (global_node_page_state(NR_ACTIVE_FILE) + \
8+
global_node_page_state(NR_INACTIVE_FILE))
99
#define nr_inactive_file_pages() global_node_page_state(NR_INACTIVE_FILE)
1010

1111
#endif /* _ZFS_PAGE_COMPAT_H */

man/man4/zfs.4

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,9 @@ pressure on the pagecache, yet still allows the ARC to be reclaimed down to
862862
.Sy zfs_arc_min
863863
if necessary.
864864
This value is specified as percent of pagecache size (as measured by
865-
.Sy NR_FILE_PAGES ) ,
865+
.Sy NR_ACTIVE_FILE
866+
+
867+
.Sy NR_INACTIVE_FILE ) ,
866868
where that percent may exceed
867869
.Sy 100 .
868870
This

0 commit comments

Comments
 (0)