From: Mr NeilBrown Date: Tue, 11 May 2021 06:35:09 +0000 (-0700) Subject: LU-13783 libcfs: support __vmalloc with only 2 args. X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=58e6ed4d08d11ee613bdb797547759643c3da032;p=fs%2Flustre-release.git LU-13783 libcfs: support __vmalloc with only 2 args. Since v5.8-rc1~201^2~19 Commit 88dca4ca5a93 ("mm: remove the pgprot argument to __vmalloc") __vmalloc only takes 2 arguments. So introduce __ll_vmalloc which takes 2 args, and calls __vmalloc with correct number of args. Lustre-change: https://review.whamcloud.com/40328 Lustre-commit: 2a32eaa35dd7b96bb29f6a17991f48fe07fa833e Test-Parameters: trivial Signed-off-by: Mr NeilBrown Change-Id: I2c89512a12e28b27544a891620e448a9b752b089 Reviewed-by: Aurelien Degremont Reviewed-by: Chris Horn Reviewed-on: https://review.whamcloud.com/43645 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index 531885c..a6d212d 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -1290,6 +1290,23 @@ EXTRA_KCFLAGS="$tmp_flags" ]) # LIBCFS_CACHE_DETAIL_WRITERS # +# LIBCFS_VMALLOC_2ARGS +# +# kernel v5.8-rc1~201^2~19 +# mm: remove the pgprot argument to __vmalloc +AC_DEFUN([LIBCFS_VMALLOC_2ARGS], [ +LB_CHECK_COMPILE([if __vmalloc has 2 args], +vmalloc_2args, [ + #include +],[ + __vmalloc(0, 0); +],[ + AC_DEFINE(HAVE_VMALLOC_2ARGS, 1, + [__vmalloc only takes 2 args.]) +]) +]) # LIBCFS_VMALLOC_2ARGS + +# # LIBCFS_HAVE_PROC_OPS # # v5.5-8862-gd56c0d45f0e2 @@ -1496,6 +1513,7 @@ LIBCFS_HAVE_NR_UNSTABLE_NFS # 5.8 LIBCFS_HAVE_MMAP_LOCK LIBCFS_KERNEL_SETSOCKOPT +LIBCFS_VMALLOC_2ARGS ]) # LIBCFS_PROG_LINUX # diff --git a/libcfs/include/libcfs/linux/linux-mem.h b/libcfs/include/libcfs/linux/linux-mem.h index 956de36..3aab43b 100644 --- a/libcfs/include/libcfs/linux/linux-mem.h +++ b/libcfs/include/libcfs/linux/linux-mem.h @@ -182,4 +182,10 @@ static inline void mmap_read_unlock(struct mm_struct *mm) } #endif +#ifdef HAVE_VMALLOC_2ARGS +#define __ll_vmalloc(size, flags) __vmalloc(size, flags) +#else +#define __ll_vmalloc(size, flags) __vmalloc(size, flags, PAGE_KERNEL) +#endif + #endif /* __LINUX_CFS_MEM_H__ */ diff --git a/lnet/klnds/gnilnd/gnilnd.h b/lnet/klnds/gnilnd/gnilnd.h index 571f9b9..8f94487 100644 --- a/lnet/klnds/gnilnd/gnilnd.h +++ b/lnet/klnds/gnilnd/gnilnd.h @@ -997,12 +997,10 @@ static inline void *kgnilnd_vzalloc(int size) { void *ret; if (*kgnilnd_tunables.kgn_vzalloc_noretry) - ret = __vmalloc(size, __GFP_HIGHMEM | GFP_NOIO | __GFP_NORETRY | - __GFP_ZERO, - PAGE_KERNEL); + ret = __ll_vmalloc(size, __GFP_HIGHMEM | GFP_NOIO | __GFP_ZERO | + __GFP_NORETRY); else - ret = __vmalloc(size, __GFP_HIGHMEM | GFP_NOIO | __GFP_ZERO, - PAGE_KERNEL); + ret = __ll_vmalloc(size, __GFP_HIGHMEM | GFP_NOIO | __GFP_ZERO); LIBCFS_ALLOC_POST(ret, size); return ret; diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index ec55fea..83b1e7c 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -829,8 +829,7 @@ do { \ #define __OBD_VMALLOC_VERBOSE(ptr, cptab, cpt, size) \ do { \ (ptr) = cptab == NULL ? \ - __vmalloc(size, GFP_NOFS | __GFP_HIGHMEM | __GFP_ZERO, \ - PAGE_KERNEL) : \ + __ll_vmalloc(size, GFP_NOFS | __GFP_HIGHMEM | __GFP_ZERO) : \ cfs_cpt_vzalloc(cptab, cpt, size); \ if (unlikely((ptr) == NULL)) { \ CERROR("vmalloc of '" #ptr "' (%d bytes) failed\n", \