diff options
author | Kevin Bowling <kevin.bowling@kev009.com> | 2021-07-16 20:28:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-16 20:28:55 +0000 |
commit | ca14e08cbff36cadd26928cb01222707930973cb (patch) | |
tree | 429bf41614af198ab7cfe7eb19b60d4fb28f03de | |
parent | b17b19943edfe734211388c6ebd626109232cf17 (diff) | |
download | src-ca14e08cbff36cadd26928cb01222707930973cb.tar.gz src-ca14e08cbff36cadd26928cb01222707930973cb.zip |
Detect HAVE_LARGE_STACKS at compile time
Move HAVE_LARGE_STACKS definitions to header and set when appropriate.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Kevin Bowling <kbowling@FreeBSD.org>
Closes #12350
-rw-r--r-- | config/Rules.am | 1 | ||||
-rw-r--r-- | config/kernel-config-defined.m4 | 31 | ||||
-rw-r--r-- | include/os/freebsd/zfs/sys/zfs_context_os.h | 4 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/zfs_context_os.h | 5 | ||||
-rw-r--r-- | lib/libspl/include/os/freebsd/sys/zfs_context_os.h | 1 | ||||
-rw-r--r-- | lib/libspl/include/os/linux/sys/zfs_context_os.h | 3 |
6 files changed, 13 insertions, 32 deletions
diff --git a/config/Rules.am b/config/Rules.am index 8fe2fa9ca8d9..be80c1e9c7ce 100644 --- a/config/Rules.am +++ b/config/Rules.am @@ -39,7 +39,6 @@ AM_CPPFLAGS = -D_GNU_SOURCE AM_CPPFLAGS += -D_REENTRANT AM_CPPFLAGS += -D_FILE_OFFSET_BITS=64 AM_CPPFLAGS += -D_LARGEFILE64_SOURCE -AM_CPPFLAGS += -DHAVE_LARGE_STACKS=1 AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\" AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\" AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\" diff --git a/config/kernel-config-defined.m4 b/config/kernel-config-defined.m4 index 9b9468269ca3..c7d18b49b14e 100644 --- a/config/kernel-config-defined.m4 +++ b/config/kernel-config-defined.m4 @@ -19,7 +19,6 @@ AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEFINED], [ ]) ]) - ZFS_AC_KERNEL_SRC_CONFIG_THREAD_SIZE ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_INFLATE @@ -29,7 +28,6 @@ AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEFINED], [ ZFS_LINUX_TEST_COMPILE_ALL([config]) AC_MSG_RESULT([done]) - ZFS_AC_KERNEL_CONFIG_THREAD_SIZE ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE @@ -37,35 +35,6 @@ AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEFINED], [ ]) dnl # -dnl # Check configured THREAD_SIZE -dnl # -dnl # The stack size will vary by architecture, but as of Linux 3.15 on x86_64 -dnl # the default thread stack size was increased to 16K from 8K. Therefore, -dnl # on newer kernels and some architectures stack usage optimizations can be -dnl # conditionally applied to improve performance without negatively impacting -dnl # stability. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_THREAD_SIZE], [ - ZFS_LINUX_TEST_SRC([config_thread_size], [ - #include <linux/module.h> - ],[ - #if (THREAD_SIZE < 16384) - #error "THREAD_SIZE is less than 16K" - #endif - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_CONFIG_THREAD_SIZE], [ - AC_MSG_CHECKING([whether kernel was built with 16K or larger stacks]) - ZFS_LINUX_TEST_RESULT([config_thread_size], [ - AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_LARGE_STACKS, 1, [kernel has large stacks]) - ],[ - AC_MSG_RESULT([no]) - ]) -]) - -dnl # dnl # Check CONFIG_DEBUG_LOCK_ALLOC dnl # dnl # This is typically only set for debug kernels because it comes with diff --git a/include/os/freebsd/zfs/sys/zfs_context_os.h b/include/os/freebsd/zfs/sys/zfs_context_os.h index 8dbe907d098c..a32eb52c53c1 100644 --- a/include/os/freebsd/zfs/sys/zfs_context_os.h +++ b/include/os/freebsd/zfs/sys/zfs_context_os.h @@ -41,6 +41,10 @@ #include <sys/ccompat.h> #include <linux/types.h> +#if KSTACK_PAGES * PAGE_SIZE >= 16384 +#define HAVE_LARGE_STACKS 1 +#endif + #define cond_resched() kern_yield(PRI_USER) #define taskq_create_sysdc(a, b, d, e, p, dc, f) \ diff --git a/include/os/linux/zfs/sys/zfs_context_os.h b/include/os/linux/zfs/sys/zfs_context_os.h index de7015b929b6..981a6b8a63e5 100644 --- a/include/os/linux/zfs/sys/zfs_context_os.h +++ b/include/os/linux/zfs/sys/zfs_context_os.h @@ -25,5 +25,10 @@ #include <linux/dcache_compat.h> #include <linux/utsname_compat.h> +#include <linux/module.h> + +#if THREAD_SIZE >= 16384 +#define HAVE_LARGE_STACKS 1 +#endif #endif diff --git a/lib/libspl/include/os/freebsd/sys/zfs_context_os.h b/lib/libspl/include/os/freebsd/sys/zfs_context_os.h index f5a136d22125..b9bf487c2aef 100644 --- a/lib/libspl/include/os/freebsd/sys/zfs_context_os.h +++ b/lib/libspl/include/os/freebsd/sys/zfs_context_os.h @@ -29,6 +29,7 @@ #ifndef ZFS_CONTEXT_OS_H_ #define ZFS_CONTEXT_OS_H_ +#define HAVE_LARGE_STACKS 1 #define ZFS_EXPORTS_PATH "/etc/zfs/exports" #endif diff --git a/lib/libspl/include/os/linux/sys/zfs_context_os.h b/lib/libspl/include/os/linux/sys/zfs_context_os.h index 008e57df4eae..81ced5207749 100644 --- a/lib/libspl/include/os/linux/sys/zfs_context_os.h +++ b/lib/libspl/include/os/linux/sys/zfs_context_os.h @@ -22,4 +22,7 @@ #ifndef ZFS_CONTEXT_OS_H #define ZFS_CONTEXT_OS_H + +#define HAVE_LARGE_STACKS 1 + #endif |