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 <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Closes zfsonlinux/zfs#3680
Closes #471
This commit is contained in:
Tim Chase 2015-08-12 09:57:35 -05:00 committed by Brian Behlendorf
parent 8ac6ffecaf
commit 851a549305
1 changed files with 4 additions and 1 deletions

View File

@ -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)