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 <behlendorf1@llnl.gov>
Signed-off-by: Coleman Kane <ckane@colemankane.org>
Closes #10696
This commit is contained in:
Coleman Kane 2020-08-09 12:07:49 -04:00 committed by Brian Behlendorf
parent 1823c8fe6a
commit dcdc12e8ba
3 changed files with 26 additions and 1 deletions

View File

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

View File

@ -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 */

View File

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