]> git.proxmox.com Git - mirror_spl.git/commitdiff
Include other sources of freeable memory in the freemem calculation
authorTim Chase <tim@chase2k.com>
Wed, 12 Aug 2015 14:57:35 +0000 (09:57 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 19 Aug 2015 16:25:30 +0000 (09:25 -0700)
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 <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Closes zfsonlinux/zfs#3680
Closes #471

include/sys/vmsystm.h

index 2fa169523ddfd0efa6a2768301bd707108681240..9d334fe0a16e7bcf04bbdb61be80eaedf596f651 100644 (file)
 
 #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)