diff options
author | Chunwei Chen <[email protected]> | 2016-04-12 12:05:14 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-04-25 17:04:07 -0700 |
commit | cdd39dd2457ac57622339669db0536a580374bd3 (patch) | |
tree | 71a77ae2758f91df5385fe4e6181eb755e619422 /config | |
parent | 224817e2a81912b46453a96b9eec4804856c801b (diff) |
Use kernel provided mutex owner
To reduce mutex footprint, we detect the existence of owner in kernel mutex,
and rely on it if it exists.
Note that before Linux 3.0, mutex owner is of type thread_info. Also note
that, in Linux 3.18, the condition for owner is changed from
CONFIG_DEBUG_MUTEXES || CONFIG_SMP to
CONFIG_DEBUG_MUTEXES || CONFIG_MUTEX_SPIN_ON_OWNER
Signed-off-by: Chunwei Chen <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #540
Diffstat (limited to 'config')
-rw-r--r-- | config/spl-build.m4 | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/config/spl-build.m4 b/config/spl-build.m4 index b9c04a95e..55453c822 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -44,6 +44,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [ SPL_AC_USLEEP_RANGE SPL_AC_KMEM_CACHE_ALLOCFLAGS SPL_AC_WAIT_ON_BIT + SPL_AC_MUTEX_OWNER ]) AC_DEFUN([SPL_AC_MODULE_SYMVERS], [ @@ -1447,3 +1448,31 @@ AC_DEFUN([SPL_AC_WAIT_ON_BIT], [ AC_MSG_RESULT(no) ]) ]) + +dnl # +dnl # Check whether mutex has owner with task_struct type. +dnl # +dnl # Note that before Linux 3.0, mutex owner is of type thread_info. +dnl # +dnl # Note that in Linux 3.18, the condition for owner is changed from +dnl # defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP) to +dnl # defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER) +dnl # +AC_DEFUN([SPL_AC_MUTEX_OWNER], [ + AC_MSG_CHECKING([whether mutex has owner]) + tmp_flags="$EXTRA_KCFLAGS" + EXTRA_KCFLAGS="-Werror" + SPL_LINUX_TRY_COMPILE([ + #include <linux/mutex.h> + ],[ + DEFINE_MUTEX(m); + struct task_struct *t __attribute__ ((unused)); + t = m.owner; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MUTEX_OWNER, 1, [yes]) + ],[ + AC_MSG_RESULT(no) + ]) + EXTRA_KCFLAGS="$tmp_flags" +]) |