aboutsummaryrefslogtreecommitdiffstats
path: root/config
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 /config
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 'config')
-rw-r--r--config/kernel-kmem.m424
-rw-r--r--config/kernel.m42
2 files changed, 26 insertions, 0 deletions
diff --git a/config/kernel-kmem.m4 b/config/kernel-kmem.m4
index cc055e530..286229916 100644
--- a/config/kernel-kmem.m4
+++ b/config/kernel-kmem.m4
@@ -56,3 +56,27 @@ AC_DEFUN([SPL_AC_DEBUG_KMEM_TRACKING], [
AC_MSG_CHECKING([whether detailed kmem tracking is enabled])
AC_MSG_RESULT([$enable_debug_kmem_tracking])
])
+
+dnl #
+dnl # 4.12 API,
+dnl # Added kvmalloc allocation strategy
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_SRC_KVMALLOC], [
+ ZFS_LINUX_TEST_SRC([kvmalloc], [
+ #include <linux/mm.h>
+ ],[
+ void *p __attribute__ ((unused));
+
+ p = kvmalloc(0, GFP_KERNEL);
+ ])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_KVMALLOC], [
+ AC_MSG_CHECKING([whether kvmalloc(ptr, flags) is available])
+ ZFS_LINUX_TEST_RESULT([kvmalloc], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_KVMALLOC, 1, [kvmalloc exists])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
diff --git a/config/kernel.m4 b/config/kernel.m4
index 1e39c15ca..4309d5456 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -44,6 +44,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
ZFS_AC_KERNEL_SRC_SCHED
ZFS_AC_KERNEL_SRC_USLEEP_RANGE
ZFS_AC_KERNEL_SRC_KMEM_CACHE
+ ZFS_AC_KERNEL_SRC_KVMALLOC
ZFS_AC_KERNEL_SRC_WAIT
ZFS_AC_KERNEL_SRC_INODE_TIMES
ZFS_AC_KERNEL_SRC_INODE_LOCK
@@ -137,6 +138,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
ZFS_AC_KERNEL_SCHED
ZFS_AC_KERNEL_USLEEP_RANGE
ZFS_AC_KERNEL_KMEM_CACHE
+ ZFS_AC_KERNEL_KVMALLOC
ZFS_AC_KERNEL_WAIT
ZFS_AC_KERNEL_INODE_TIMES
ZFS_AC_KERNEL_INODE_LOCK