diff --git a/config/kernel-kmem.m4 b/config/kernel-kmem.m4 index 2862299168c1..43f9e72f88d8 100644 --- a/config/kernel-kmem.m4 +++ b/config/kernel-kmem.m4 @@ -80,3 +80,29 @@ AC_DEFUN([ZFS_AC_KERNEL_KVMALLOC], [ AC_MSG_RESULT(no) ]) ]) + +dnl # +dnl # 5.8 API, +dnl # __vmalloc PAGE_KERNEL removal +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_VMALLOC_PAGE_KERNEL], [ + ZFS_LINUX_TEST_SRC([__vmalloc], [ + #include + #include + ],[ + void *p __attribute__ ((unused)); + + p = __vmalloc(0, GFP_KERNEL, PAGE_KERNEL); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_VMALLOC_PAGE_KERNEL], [ + AC_MSG_CHECKING([whether __vmalloc(ptr, flags, pageflags) is available]) + ZFS_LINUX_TEST_RESULT([__vmalloc], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_VMALLOC_PAGE_KERNEL, 1, [__vmalloc page flags exists]) + ],[ + AC_MSG_RESULT(no) + ]) +]) +- \ No newline at end of file diff --git a/config/kernel.m4 b/config/kernel.m4 index 8cbf4aee9899..78b0ce4d3aa9 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -47,6 +47,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_USLEEP_RANGE ZFS_AC_KERNEL_SRC_KMEM_CACHE ZFS_AC_KERNEL_SRC_KVMALLOC + ZFS_AC_KERNEL_SRC_VMALLOC_PAGE_KERNEL ZFS_AC_KERNEL_SRC_WAIT ZFS_AC_KERNEL_SRC_INODE_TIMES ZFS_AC_KERNEL_SRC_INODE_LOCK @@ -141,6 +142,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_USLEEP_RANGE ZFS_AC_KERNEL_KMEM_CACHE ZFS_AC_KERNEL_KVMALLOC + ZFS_AC_KERNEL_VMALLOC_PAGE_KERNEL ZFS_AC_KERNEL_WAIT ZFS_AC_KERNEL_INODE_TIMES ZFS_AC_KERNEL_INODE_LOCK diff --git a/module/os/linux/spl/spl-kmem-cache.c b/module/os/linux/spl/spl-kmem-cache.c index 2ebbb43d18b7..2f7a5523d15c 100644 --- a/module/os/linux/spl/spl-kmem-cache.c +++ b/module/os/linux/spl/spl-kmem-cache.c @@ -203,7 +203,11 @@ kv_alloc(spl_kmem_cache_t *skc, int size, int flags) ASSERT(ISP2(size)); ptr = (void *)__get_free_pages(lflags, get_order(size)); } else { +#ifdef HAVE_VMALLOC_PAGE_KERNEL ptr = __vmalloc(size, lflags | __GFP_HIGHMEM, PAGE_KERNEL); +#else + ptr = __vmalloc(size, lflags | __GFP_HIGHMEM); +#endif } /* Resulting allocated memory will be page aligned */ diff --git a/module/os/linux/spl/spl-kmem.c b/module/os/linux/spl/spl-kmem.c index b51e203edfe2..23ddefc5c418 100644 --- a/module/os/linux/spl/spl-kmem.c +++ b/module/os/linux/spl/spl-kmem.c @@ -202,7 +202,11 @@ spl_kvmalloc(size_t size, gfp_t lflags) return (ptr); } +#ifdef HAVE_VMALLOC_PAGE_KERNEL return (__vmalloc(size, lflags | __GFP_HIGHMEM, PAGE_KERNEL)); +#else + return (__vmalloc(size, lflags | __GFP_HIGHMEM)); +#endif } /* @@ -251,8 +255,12 @@ spl_kmem_alloc_impl(size_t size, int flags, int node) */ if (size > spl_kmem_alloc_max) { if (flags & KM_VMEM) { +#ifdef HAVE_VMALLOC_PAGE_KERNEL ptr = __vmalloc(size, lflags | __GFP_HIGHMEM, PAGE_KERNEL); +#else + ptr = __vmalloc(size, lflags | __GFP_HIGHMEM); +#endif } else { return (NULL); }