Whamcloud - gitweb
LU-13783 osc: handle removal of NR_UNSTABLE_NFS 60/39260/4
authorMr NeilBrown <neilb@suse.de>
Fri, 3 Jul 2020 05:33:36 +0000 (15:33 +1000)
committerOleg Drokin <green@whamcloud.com>
Sat, 12 Sep 2020 15:45:19 +0000 (15:45 +0000)
In Linux 5.8 the NR_UNSTABLE_NFS page counters are go.  All pages that
have been writen but are not yet safe are now counted in NR_WRITEBACK.

So change osc_page to count in NR_WRITEBACK, but if NR_UNSTABLE_NFS
still exists in the kernel, use a #define to direct the updates to
that counter.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I49cbc267fafaee949f45b2e559511aedcf4d8fed
Reviewed-on: https://review.whamcloud.com/39260
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/autoconf/lustre-libcfs.m4
lustre/osc/osc_page.c

index dcf8028..529b534 100644 (file)
@@ -1289,6 +1289,29 @@ cache_detail_writers_atomic, [
 EXTRA_KCFLAGS="$tmp_flags"
 ]) # LIBCFS_CACHE_DETAIL_WRITERS
 
 EXTRA_KCFLAGS="$tmp_flags"
 ]) # LIBCFS_CACHE_DETAIL_WRITERS
 
+#
+# LIBCFS_HAVE_NR_UNSTABLE_NFS
+#
+# kernel v5.8-rc1~201^2~75
+# mm/writeback: discard NR_UNSTABLE_NFS, use NR_WRITEBACK instead
+#
+AC_DEFUN([LIBCFS_HAVE_NR_UNSTABLE_NFS], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if NR_UNSTABLE_NFS still in use],
+nr_unstable_nfs_exists, [
+       #include <linux/mm.h>
+
+       int i;
+],[
+       i = NR_UNSTABLE_NFS;
+],[
+       AC_DEFINE(HAVE_NR_UNSTABLE_NFS, 1,
+               [NR_UNSTABLE_NFS is still in use.])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LIBCFS_HAVE_NR_UNSTABLE_NFS
+
 AC_DEFUN([LIBCFS_PROG_LINUX_SRC], [] )
 AC_DEFUN([LIBCFS_PROG_LINUX_RESULTS], [])
 
 AC_DEFUN([LIBCFS_PROG_LINUX_SRC], [] )
 AC_DEFUN([LIBCFS_PROG_LINUX_RESULTS], [])
 
@@ -1396,6 +1419,7 @@ LIBCFS_GET_REQUEST_KEY_AUTH
 LIBCFS_LOOKUP_USER_KEY
 LIBCFS_FORCE_SIG_WITH_TASK
 LIBCFS_CACHE_DETAIL_WRITERS
 LIBCFS_LOOKUP_USER_KEY
 LIBCFS_FORCE_SIG_WITH_TASK
 LIBCFS_CACHE_DETAIL_WRITERS
+LIBCFS_HAVE_NR_UNSTABLE_NFS
 ]) # LIBCFS_PROG_LINUX
 
 #
 ]) # LIBCFS_PROG_LINUX
 
 #
index ae7d01b..0f009b3 100644 (file)
@@ -875,6 +875,13 @@ void osc_lru_unreserve(struct client_obd *cli, unsigned long npages)
  * In practice this can work pretty good because the pages in the same RPC
  * are likely from the same page zone.
  */
  * In practice this can work pretty good because the pages in the same RPC
  * are likely from the same page zone.
  */
+#ifdef HAVE_NR_UNSTABLE_NFS
+/* Old kernels use a separate counter for unstable pages,
+ * newer kernels treat them like any other writeback.
+ */
+#define NR_WRITEBACK NR_UNSTABLE_NFS
+#endif
+
 static inline void unstable_page_accounting(struct ptlrpc_bulk_desc *desc,
                                            struct osc_brw_async_args *aa,
                                            int factor)
 static inline void unstable_page_accounting(struct ptlrpc_bulk_desc *desc,
                                            struct osc_brw_async_args *aa,
                                            int factor)
@@ -903,7 +910,7 @@ static inline void unstable_page_accounting(struct ptlrpc_bulk_desc *desc,
                }
 
                if (count > 0) {
                }
 
                if (count > 0) {
-                       mod_zone_page_state(zone, NR_UNSTABLE_NFS,
+                       mod_zone_page_state(zone, NR_WRITEBACK,
                                            factor * count);
                        count = 0;
                }
                                            factor * count);
                        count = 0;
                }
@@ -911,7 +918,7 @@ static inline void unstable_page_accounting(struct ptlrpc_bulk_desc *desc,
                ++count;
        }
        if (count > 0)
                ++count;
        }
        if (count > 0)
-               mod_zone_page_state(zone, NR_UNSTABLE_NFS, factor * count);
+               mod_zone_page_state(zone, NR_WRITEBACK, factor * count);
 }
 
 static inline void add_unstable_page_accounting(struct ptlrpc_bulk_desc *desc,
 }
 
 static inline void add_unstable_page_accounting(struct ptlrpc_bulk_desc *desc,