From dcdc12e8babb2490249cd93ec77863b216c25c5d Mon Sep 17 00:00:00 2001 From: Coleman Kane Date: Sun, 9 Aug 2020 12:07:49 -0400 Subject: Linux 5.9 compat: Update NR_SLAB_RECLAIMABLE to NR_SLAB_RECLAIMABLE_B This change appears to primarily be a name change for the enum. Had to update the test logic so that it works so long as either one of these is present (favoring the newer one). Additionally, as this is newer, it only shows up in node_page_item, so this commit doesn't test zone_page_item for the same enum. Reviewed-by: Brian Behlendorf Signed-off-by: Coleman Kane Closes #10696 --- include/os/linux/kernel/linux/page_compat.h | 14 ++++++++++++++ include/os/linux/spl/sys/vmsystm.h | 7 +++++++ 2 files changed, 21 insertions(+) (limited to 'include/os') diff --git a/include/os/linux/kernel/linux/page_compat.h b/include/os/linux/kernel/linux/page_compat.h index 95acb7d53..8ad04f9bb 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 5807d960a..705339486 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) -- cgit v1.2.3