1 diff -urN zfs-0.8.4/config/kernel-kmem.m4 zfs-0.8.4-5.8/config/kernel-kmem.m4
2 --- zfs-0.8.4/config/kernel-kmem.m4 1970-01-01 01:00:00.000000000 +0100
3 +++ zfs-0.8.4-5.8/config/kernel-kmem.m4 2020-08-16 20:47:36.079945075 +0200
7 +dnl # __vmalloc PAGE_KERNEL removal
9 +AC_DEFUN([ZFS_AC_KERNEL_SRC_VMALLOC_PAGE_KERNEL], [
10 + ZFS_LINUX_TEST_SRC([__vmalloc], [
11 + #include <linux/mm.h>
12 + #include <linux/vmalloc.h>
14 + void *p __attribute__ ((unused));
16 + p = __vmalloc(0, GFP_KERNEL, PAGE_KERNEL);
20 +AC_DEFUN([ZFS_AC_KERNEL_VMALLOC_PAGE_KERNEL], [
21 + AC_MSG_CHECKING([whether __vmalloc(ptr, flags, pageflags) is available])
22 + ZFS_LINUX_TEST_RESULT([__vmalloc], [
24 + AC_DEFINE(HAVE_VMALLOC_PAGE_KERNEL, 1, [__vmalloc page flags exists])
29 diff -ur zfs-0.8.4/aclocal.m4 zfs-0.8.4-5.8/aclocal.m4
30 --- zfs-0.8.4/aclocal.m4 2020-05-05 18:56:50.832844255 +0200
31 +++ zfs-0.8.4-5.8/aclocal.m4 2020-08-16 20:47:51.756613733 +0200
33 m4_include([config/kernel-invalidate-bdev-args.m4])
34 m4_include([config/kernel-is_owner_or_cap.m4])
35 m4_include([config/kernel-kmap-atomic-args.m4])
36 +m4_include([config/kernel-kmem.m4])
37 m4_include([config/kernel-kmem-cache.m4])
38 m4_include([config/kernel-kstrtoul.m4])
39 m4_include([config/kernel-ktime.m4])
40 diff -ur zfs-0.8.4/config/kernel.m4 zfs-0.8.4-5.8/config/kernel.m4
41 --- zfs-0.8.4/config/kernel.m4 2020-08-16 20:52:32.199984184 +0200
42 +++ zfs-0.8.4-5.8/config/kernel.m4 2020-08-16 20:48:47.436620888 +0200
44 ZFS_AC_KERNEL_SRC_SCHED
45 ZFS_AC_KERNEL_SRC_USLEEP_RANGE
46 ZFS_AC_KERNEL_SRC_KMEM_CACHE
47 + ZFS_AC_KERNEL_SRC_VMALLOC_PAGE_KERNEL
48 ZFS_AC_KERNEL_SRC_WAIT
49 ZFS_AC_KERNEL_SRC_INODE_TIMES
50 ZFS_AC_KERNEL_SRC_INODE_LOCK
53 ZFS_AC_KERNEL_USLEEP_RANGE
54 ZFS_AC_KERNEL_KMEM_CACHE
55 + ZFS_AC_KERNEL_VMALLOC_PAGE_KERNEL
57 ZFS_AC_KERNEL_INODE_TIMES
58 ZFS_AC_KERNEL_INODE_LOCK
59 diff -ur zfs-0.8.4/include/spl/sys/kmem.h zfs-0.8.4-5.8/include/spl/sys/kmem.h
60 --- zfs-0.8.4/include/spl/sys/kmem.h 2020-05-05 18:56:29.717370676 +0200
61 +++ zfs-0.8.4-5.8/include/spl/sys/kmem.h 2020-08-16 20:49:25.949959237 +0200
63 extern void spl_kmem_free(const void *ptr, size_t sz);
66 + * 5.8 API change, pgprot_t argument removed.
68 +#ifdef HAVE_VMALLOC_PAGE_KERNEL
69 +#define spl_vmalloc(size, flags) __vmalloc(size, flags, PAGE_KERNEL)
71 +#define spl_vmalloc(size, flags) __vmalloc(size, flags)
75 * The following functions are only available for internal use.
77 extern void *spl_kmem_alloc_impl(size_t size, int flags, int node);
78 diff -ur zfs-0.8.4/module/spl/spl-kmem.c zfs-0.8.4-5.8/module/spl/spl-kmem.c
79 --- zfs-0.8.4/module/spl/spl-kmem.c 2020-05-05 18:57:28.442960922 +0200
80 +++ zfs-0.8.4-5.8/module/spl/spl-kmem.c 2020-08-16 20:52:08.019980890 +0200
82 * kmem_zalloc() callers.
84 * For vmem_alloc() and vmem_zalloc() callers it is permissible
85 - * to use __vmalloc(). However, in general use of __vmalloc()
86 - * is strongly discouraged because a global lock must be
87 - * acquired. Contention on this lock can significantly
88 + * to use spl_vmalloc(). However, in general use of
89 + * spl_vmalloc() is strongly discouraged because a global lock
90 + * must be acquired. Contention on this lock can significantly
91 * impact performance so frequently manipulating the virtual
92 * address space is strongly discouraged.
94 if ((size > spl_kmem_alloc_max) || use_vmem) {
95 if (flags & KM_VMEM) {
96 - ptr = __vmalloc(size, lflags | __GFP_HIGHMEM,
98 + ptr = spl_vmalloc(size, lflags | __GFP_HIGHMEM);
102 diff -ur zfs-0.8.4/module/spl/spl-kmem-cache.c zfs-0.8.4-5.8/module/spl/spl-kmem-cache.c
103 --- zfs-0.8.4/module/spl/spl-kmem-cache.c 2020-05-05 18:57:28.442960922 +0200
104 +++ zfs-0.8.4-5.8/module/spl/spl-kmem-cache.c 2020-08-16 20:50:28.763300871 +0200
107 ptr = (void *)__get_free_pages(lflags, get_order(size));
109 - ptr = __vmalloc(size, lflags | __GFP_HIGHMEM, PAGE_KERNEL);
110 + ptr = spl_vmalloc(size, lflags | __GFP_HIGHMEM);
113 /* Resulting allocated memory will be page aligned */
114 @@ -1242,7 +1242,7 @@
117 * However, this can't be applied to KVM_VMEM due to a bug that
118 - * __vmalloc() doesn't honor gfp flags in page table allocation.
119 + * spl_vmalloc() doesn't honor gfp flags in page table allocation.
121 if (!(skc->skc_flags & KMC_VMEM)) {
122 rc = __spl_cache_grow(skc, flags | KM_NOSLEEP);