summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMichael Niewöhner <[email protected]>2019-07-21 19:34:07 +0200
committerBrian Behlendorf <[email protected]>2019-11-13 10:05:10 -0800
commit66955885e24427a94e938c013da214bd5c0177d4 (patch)
tree3f00fd60867f7a8de3848fe6d4074822de44717f /include
parentc025008df5398be4eb7f5b98e75822f447833dd4 (diff)
Make use of kvmalloc if available and fix vmem_alloc implementation
This patch implements use of kvmalloc for GFP_KERNEL allocations, which may increase performance if the allocator is able to allocate physical memory, if kvmalloc is available as a public kernel interface (since v4.12). Otherwise it will simply fall back to virtual memory (vmalloc). Also fix vmem_alloc implementation which can lead to slow allocations since the first attempt with kmalloc does not make use of the noretry flag but tells the linux kernel to retry several times before it fails. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Matt Ahrens <[email protected]> Signed-off-by: Sebastian Gottschall <[email protected]> Signed-off-by: Michael Niewöhner <[email protected]> Closes #9034
Diffstat (limited to 'include')
-rw-r--r--include/os/linux/spl/sys/kmem.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/os/linux/spl/sys/kmem.h b/include/os/linux/spl/sys/kmem.h
index 986c7d244..1f51f5d98 100644
--- a/include/os/linux/spl/sys/kmem.h
+++ b/include/os/linux/spl/sys/kmem.h
@@ -28,6 +28,8 @@
#include <sys/debug.h>
#include <linux/slab.h>
#include <linux/sched.h>
+#include <linux/mm.h>
+#include <linux/vmalloc.h>
extern int kmem_debugging(void);
extern char *kmem_vasprintf(const char *fmt, va_list ap);
@@ -47,6 +49,7 @@ extern void kmem_strfree(char *str);
#define KM_PUBLIC_MASK (KM_SLEEP | KM_NOSLEEP | KM_PUSHPAGE)
static int spl_fstrans_check(void);
+void *spl_kvmalloc(size_t size, gfp_t flags);
/*
* Convert a KM_* flags mask to its Linux GFP_* counterpart. The conversion