aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTim Chase <[email protected]>2015-08-12 09:57:35 -0500
committerBrian Behlendorf <[email protected]>2015-08-19 09:25:30 -0700
commit851a549305ad9001e7a6dfbf735f501b286e9d08 (patch)
tree7a26213af8d3766b9345c95dfeac794144b388c0 /include
parent8ac6ffecaf6dacfec6c5cb24d0bc8b3d40db63ef (diff)
Include other sources of freeable memory in the freemem calculation
Prevents ARC collapse when non-ZFS filesystems, the block layer or other memory consumers use a lot of reclaimable memory in the page cache. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Tim Chase <[email protected]> Closes zfsonlinux/zfs#3680 Closes #471
Diffstat (limited to 'include')
-rw-r--r--include/sys/vmsystm.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/sys/vmsystm.h b/include/sys/vmsystm.h
index 2fa169523..9d334fe0a 100644
--- a/include/sys/vmsystm.h
+++ b/include/sys/vmsystm.h
@@ -35,7 +35,10 @@
#define membar_producer() smp_wmb()
#define physmem totalram_pages
-#define freemem nr_free_pages()
+#define freemem (nr_free_pages() + \
+ global_page_state(NR_INACTIVE_FILE) + \
+ global_page_state(NR_INACTIVE_ANON) + \
+ global_page_state(NR_SLAB_RECLAIMABLE))
#define xcopyin(from, to, size) copy_from_user(to, from, size)
#define xcopyout(from, to, size) copy_to_user(to, from, size)