Whamcloud - gitweb
LU-16699 osc: Prefer NR_ZONE_WRITE_PENDING 99/50499/11
authorShaun Tancheff <shaun.tancheff@hpe.com>
Sun, 2 Apr 2023 16:33:44 +0000 (11:33 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 23 Sep 2023 06:04:27 +0000 (06:04 +0000)
Linux commit v4.7-5966-g5a1c84b404a7
 mm: remove reclaim and compaction retry approximations

Introduced NR_ZONE_WRITE_PENDING which should be used
in mod_zone_page_state.

Older kernels should fallback to NR_UNSTABLE_NFS
or NR_WRITEBACK.

Test-Parameters: trivial
HPE-bug-id: LUS-11559
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I90f22d4bd56f5986eaa5d4a042a2c8ed31fbf752
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50499
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
libcfs/autoconf/lustre-libcfs.m4
lustre/osc/osc_page.c

index 4ff1c5d..b13ed0b 100644 (file)
@@ -856,6 +856,28 @@ AC_DEFUN([LIBCFS_RHASHTABLE_INSERT_FAST], [
 ]) # LIBCFS_RHASHTABLE_INSERT_FAST
 
 #
+# LIBCFS_HAVE_NR_ZONE_WRITE_PENDING
+#
+# kernel v4.7-5966-g5a1c84b404a7
+# mm: remove reclaim and compaction retry approximations
+#
+AC_DEFUN([LIBCFS_SRC_HAVE_NR_ZONE_WRITE_PENDING], [
+       LB2_LINUX_TEST_SRC([nr_zone_write_pending_exists], [
+               #include <linux/mmzone.h>
+       ],[
+               enum zone_stat_item item = NR_ZONE_WRITE_PENDING;
+               (void)item;
+       ],[-Werror])
+])
+AC_DEFUN([LIBCFS_HAVE_NR_ZONE_WRITE_PENDING], [
+       AC_MSG_CHECKING([if NR_ZONE_WRITE_PENDING is available])
+       LB2_LINUX_TEST_RESULT([nr_zone_write_pending_exists], [
+               AC_DEFINE(HAVE_NR_ZONE_WRITE_PENDING, 1,
+                       [NR_ZONE_WRITE_PENDING is still in use.])
+       ])
+]) # LIBCFS_HAVE_NR_ZONE_WRITE_PENDING
+
+#
 # Kernel version 4.7-rc1 commit 8f6fd83c6c5ec66a4a70c728535ddcdfef4f3697
 # added 3rd arg to rhashtable_walk_init
 #
@@ -2395,6 +2417,7 @@ AC_DEFUN([LIBCFS_PROG_LINUX_SRC], [
        LIBCFS_SRC_RHASHTABLE_INSERT_FAST
        LIBCFS_SRC_RHASHTABLE_WALK_INIT_3ARG
        # 4.8
+       LIBCFS_SRC_HAVE_NR_ZONE_WRITE_PENDING
        LIBCFS_SRC_RHASHTABLE_LOOKUP
        LIBCFS_SRC_RHLTABLE
        LIBCFS_SRC_STACKTRACE_OPS
@@ -2544,6 +2567,7 @@ AC_DEFUN([LIBCFS_PROG_LINUX_RESULTS], [
        LIBCFS_RHASHTABLE_INSERT_FAST
        LIBCFS_RHASHTABLE_WALK_INIT_3ARG
        # 4.8
+       LIBCFS_HAVE_NR_ZONE_WRITE_PENDING
        LIBCFS_RHASHTABLE_LOOKUP
        LIBCFS_RHLTABLE
        LIBCFS_STACKTRACE_OPS
index 4db1f27..9012739 100644 (file)
@@ -888,7 +888,9 @@ void osc_lru_unreserve(struct client_obd *cli, unsigned long npages)
  * newer kernels treat them like any other writeback.
  * (see Linux commit: v5.7-467-g8d92890bd6b8)
  */
-#define NR_WRITEBACK NR_UNSTABLE_NFS
+#define NR_ZONE_WRITE_PENDING          ((enum zone_stat_item)NR_UNSTABLE_NFS)
+#elif !defined(HAVE_NR_ZONE_WRITE_PENDING)
+#define NR_ZONE_WRITE_PENDING          ((enum zone_stat_item)NR_WRITEBACK)
 #endif
 
 static inline void unstable_page_accounting(struct ptlrpc_bulk_desc *desc,
@@ -915,8 +917,7 @@ static inline void unstable_page_accounting(struct ptlrpc_bulk_desc *desc,
                }
 
                if (count > 0) {
-                       mod_zone_page_state(zone,
-                                           (enum zone_stat_item)NR_WRITEBACK,
+                       mod_zone_page_state(zone, NR_ZONE_WRITE_PENDING,
                                            factor * count);
                        count = 0;
                }
@@ -924,7 +925,7 @@ static inline void unstable_page_accounting(struct ptlrpc_bulk_desc *desc,
                ++count;
        }
        if (count > 0)
-               mod_zone_page_state(zone, (enum zone_stat_item)NR_WRITEBACK,
+               mod_zone_page_state(zone, NR_ZONE_WRITE_PENDING,
                                    factor * count);
 
        EXIT;