From: Mr NeilBrown Date: Fri, 3 Jul 2020 05:33:36 +0000 (+1000) Subject: LU-13783 osc: handle removal of NR_UNSTABLE_NFS X-Git-Tag: 2.13.56~36 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=3e5faa441266cd8dc2ee54ae140ad0129b4affa0;hp=e2e30106bc0c70da0111f9d677e5e671701ee932 LU-13783 osc: handle removal of NR_UNSTABLE_NFS 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 Change-Id: I49cbc267fafaee949f45b2e559511aedcf4d8fed Reviewed-on: https://review.whamcloud.com/39260 Tested-by: jenkins Reviewed-by: Shaun Tancheff Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index dcf8028..529b534 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -1289,6 +1289,29 @@ cache_detail_writers_atomic, [ 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 + + 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], []) @@ -1396,6 +1419,7 @@ LIBCFS_GET_REQUEST_KEY_AUTH LIBCFS_LOOKUP_USER_KEY LIBCFS_FORCE_SIG_WITH_TASK LIBCFS_CACHE_DETAIL_WRITERS +LIBCFS_HAVE_NR_UNSTABLE_NFS ]) # LIBCFS_PROG_LINUX # diff --git a/lustre/osc/osc_page.c b/lustre/osc/osc_page.c index ae7d01b..0f009b3 100644 --- a/lustre/osc/osc_page.c +++ b/lustre/osc/osc_page.c @@ -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. */ +#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) @@ -903,7 +910,7 @@ static inline void unstable_page_accounting(struct ptlrpc_bulk_desc *desc, } if (count > 0) { - mod_zone_page_state(zone, NR_UNSTABLE_NFS, + mod_zone_page_state(zone, NR_WRITEBACK, factor * count); count = 0; } @@ -911,7 +918,7 @@ static inline void unstable_page_accounting(struct ptlrpc_bulk_desc *desc, ++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,