diff --git a/config/kernel-global_page_state.m4 b/config/kernel-global_page_state.m4 index a0cb9e2c82..75043f40be 100644 --- a/config/kernel-global_page_state.m4 +++ b/config/kernel-global_page_state.m4 @@ -94,7 +94,9 @@ AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY], [ ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_FILE_PAGES]) ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_INACTIVE_ANON]) ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_INACTIVE_FILE]) - ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_SLAB_RECLAIMABLE]) + AS_IF([test -z "$ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B"],[ + ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_SLAB_RECLAIMABLE]) + ]) AC_MSG_RESULT(yes) ]) @@ -119,6 +121,8 @@ AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE], [ [node_stat_item], [$LINUX/include/linux/mmzone.h]) ZFS_AC_KERNEL_ENUM_MEMBER([NR_SLAB_RECLAIMABLE], [node_stat_item], [$LINUX/include/linux/mmzone.h]) + ZFS_AC_KERNEL_ENUM_MEMBER([NR_SLAB_RECLAIMABLE_B], + [node_stat_item], [$LINUX/include/linux/mmzone.h]) ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES], [zone_stat_item], [$LINUX/include/linux/mmzone.h]) diff --git a/include/os/linux/kernel/linux/page_compat.h b/include/os/linux/kernel/linux/page_compat.h index 95acb7d536..8ad04f9bbf 100644 --- a/include/os/linux/kernel/linux/page_compat.h +++ b/include/os/linux/kernel/linux/page_compat.h @@ -35,11 +35,16 @@ #else #define nr_inactive_file_pages() global_zone_page_state(NR_INACTIVE_FILE) #endif +#if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B) +#define nr_slab_reclaimable_pages() \ + global_node_page_state(NR_SLAB_RECLAIMABLE_B) +#else #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE) #define nr_slab_reclaimable_pages() global_node_page_state(NR_SLAB_RECLAIMABLE) #else #define nr_slab_reclaimable_pages() global_zone_page_state(NR_SLAB_RECLAIMABLE) #endif +#endif #elif defined(ZFS_GLOBAL_NODE_PAGE_STATE) @@ -59,11 +64,16 @@ #else #define nr_inactive_file_pages() global_page_state(NR_INACTIVE_FILE) #endif +#if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B) +#define nr_slab_reclaimable_pages() \ + global_node_page_state(NR_SLAB_RECLAIMABLE_B) +#else #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE) #define nr_slab_reclaimable_pages() global_node_page_state(NR_SLAB_RECLAIMABLE) #else #define nr_slab_reclaimable_pages() global_page_state(NR_SLAB_RECLAIMABLE) #endif +#endif #else @@ -71,7 +81,11 @@ #define nr_file_pages() global_page_state(NR_FILE_PAGES) #define nr_inactive_anon_pages() global_page_state(NR_INACTIVE_ANON) #define nr_inactive_file_pages() global_page_state(NR_INACTIVE_FILE) +#ifdef ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B +#define nr_slab_reclaimable_pages() global_page_state(NR_SLAB_RECLAIMABLE_B) +#else #define nr_slab_reclaimable_pages() global_page_state(NR_SLAB_RECLAIMABLE) +#endif /* ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B */ #endif /* ZFS_GLOBAL_ZONE_PAGE_STATE */ diff --git a/include/os/linux/spl/sys/vmsystm.h b/include/os/linux/spl/sys/vmsystm.h index 5807d960ad..705339486b 100644 --- a/include/os/linux/spl/sys/vmsystm.h +++ b/include/os/linux/spl/sys/vmsystm.h @@ -47,10 +47,17 @@ #define membar_producer() smp_wmb() #define physmem zfs_totalram_pages +#ifdef ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B +#define freemem (nr_free_pages() + \ + global_page_state(NR_INACTIVE_FILE) + \ + global_page_state(NR_INACTIVE_ANON) + \ + global_page_state(NR_SLAB_RECLAIMABLE_B)) +#else #define freemem (nr_free_pages() + \ global_page_state(NR_INACTIVE_FILE) + \ global_page_state(NR_INACTIVE_ANON) + \ global_page_state(NR_SLAB_RECLAIMABLE)) +#endif /* ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B */ #define xcopyin(from, to, size) copy_from_user(to, from, size) #define xcopyout(from, to, size) copy_to_user(to, from, size)