summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorColeman Kane <[email protected]>2020-08-09 12:07:49 -0400
committerBrian Behlendorf <[email protected]>2020-08-11 13:35:20 -0700
commitdcdc12e8babb2490249cd93ec77863b216c25c5d (patch)
tree9c627d0da8942cee133cb4baf70e3353c50565c2 /include
parent1823c8fe6a4a20971463e9b51615dad412aea9a9 (diff)
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 <[email protected]> Signed-off-by: Coleman Kane <[email protected]> Closes #10696
Diffstat (limited to 'include')
-rw-r--r--include/os/linux/kernel/linux/page_compat.h14
-rw-r--r--include/os/linux/spl/sys/vmsystm.h7
2 files changed, 21 insertions, 0 deletions
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)