Whamcloud - gitweb
LU-13783 libcfs: support __vmalloc with only 2 args. 28/40328/7
authorMr NeilBrown <neilb@suse.de>
Wed, 21 Oct 2020 04:26:35 +0000 (15:26 +1100)
committerOleg Drokin <green@whamcloud.com>
Tue, 16 Mar 2021 18:16:57 +0000 (18:16 +0000)
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.

Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I2c89512a12e28b27544a891620e448a9b752b089
Reviewed-on: https://review.whamcloud.com/40328
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Aurelien Degremont <degremoa@amazon.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/autoconf/lustre-libcfs.m4
libcfs/include/libcfs/linux/linux-mem.h
lnet/klnds/gnilnd/gnilnd.h
lustre/include/obd_support.h

index c787b14..6b20241 100644 (file)
@@ -1290,6 +1290,23 @@ EXTRA_KCFLAGS="$tmp_flags"
 ]) # LIBCFS_CACHE_DETAIL_WRITERS
 
 #
 ]) # 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 <linux/vmalloc.h>
+],[
+       __vmalloc(0, 0);
+],[
+       AC_DEFINE(HAVE_VMALLOC_2ARGS, 1,
+               [__vmalloc only takes 2 args.])
+])
+]) # LIBCFS_VMALLOC_2ARGS
+
+#
 # LIBCFS_HAVE_NR_UNSTABLE_NFS
 #
 # kernel v5.8-rc1~201^2~75
 # LIBCFS_HAVE_NR_UNSTABLE_NFS
 #
 # kernel v5.8-rc1~201^2~75
@@ -1461,6 +1478,7 @@ LIBCFS_HAVE_NR_UNSTABLE_NFS
 # 5.8
 LIBCFS_HAVE_MMAP_LOCK
 LIBCFS_KERNEL_SETSOCKOPT
 # 5.8
 LIBCFS_HAVE_MMAP_LOCK
 LIBCFS_KERNEL_SETSOCKOPT
+LIBCFS_VMALLOC_2ARGS
 ]) # LIBCFS_PROG_LINUX
 
 #
 ]) # LIBCFS_PROG_LINUX
 
 #
index 11d8fab..69d027f 100644 (file)
@@ -131,4 +131,10 @@ static inline void mmap_read_unlock(struct mm_struct *mm)
 }
 #endif
 
 }
 #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__ */
 #endif /* __LINUX_CFS_MEM_H__ */
index 03cdd07..3c7f742 100644 (file)
@@ -997,12 +997,10 @@ static inline void *kgnilnd_vzalloc(int size)
 {
        void *ret;
        if (*kgnilnd_tunables.kgn_vzalloc_noretry)
 {
        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
        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;
 
        LIBCFS_ALLOC_POST(ret, size);
        return ret;
index 1b6bba4..f820c87 100644 (file)
@@ -834,8 +834,7 @@ do {                                                                              \
 #define __OBD_VMALLOC_VERBOSE(ptr, cptab, cpt, size)                         \
 do {                                                                         \
        (ptr) = cptab == NULL ?                                               \
 #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",           \
                cfs_cpt_vzalloc(cptab, cpt, size);                            \
        if (unlikely((ptr) == NULL)) {                                        \
                CERROR("vmalloc of '" #ptr "' (%d bytes) failed\n",           \