From 5f920fbee1fd1838bad2d5a262041a3a171b6834 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 25 Feb 2015 10:23:49 -0800 Subject: Retire MUTEX_OWNER checks To minimize the size of a kmutex_t a MUTEX_OWNER check was added. It allowed the kmutex_t wrapper to leverage the mutex owner which was already stored in the mutex for certain kernel configurations. The upside to this was that it reduced the size of the kmutex_t wrapper structure by the size of a task_struct pointer (4/8 bytes). The downside was that two mutex implementations needed to be maintained. Depending on your exact kernel configuration the correct one would be selected. Over the years this solution worked but it could be fragile since it depending heavily on assumed kernel mutex implementation details. For example the SPL_AC_MUTEX_OWNER_TASK_STRUCT configure check needed to be added when the kernel changed how the owner was stored. It also made the code more complicated than it needed to be. Therefore, in the name of simplicity and portability this optimization is being retired. It will slightly increase the memory requirements for a kmutex_t but only very slightly. Signed-off-by: Brian Behlendorf Signed-off-by: Tim Chase Issue #435 --- config/spl-build.m4 | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) (limited to 'config') diff --git a/config/spl-build.m4 b/config/spl-build.m4 index d2cb68b6b..4b55809ce 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -25,8 +25,6 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [ SPL_AC_SHRINKER_CALLBACK SPL_AC_CTL_NAME SPL_AC_PDE_DATA - SPL_AC_MUTEX_OWNER - SPL_AC_MUTEX_OWNER_TASK_STRUCT SPL_AC_SET_FS_PWD_WITH_CONST SPL_AC_2ARGS_VFS_UNLINK SPL_AC_4ARGS_VFS_RENAME @@ -865,54 +863,6 @@ AC_DEFUN([SPL_AC_CTL_NAME], [ ]) ]) -dnl # -dnl # 2.6.29 API change, -dnl # Adaptive mutexs were introduced which track the mutex owner. The -dnl # mutex wrappers leverage this functionality to avoid tracking the -dnl # owner multipe times. -dnl # -AC_DEFUN([SPL_AC_MUTEX_OWNER], [ - AC_MSG_CHECKING([whether struct mutex has owner]) - SPL_LINUX_TRY_COMPILE([ - #include - ],[ - struct mutex mtx __attribute__ ((unused)); - mtx.owner = NULL; - ],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_MUTEX_OWNER, 1, [struct mutex has owner]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -dnl # -dnl # 2.6.39 API change, -dnl # Owner type change. A Linux mutex prior to 2.6.39 would store -dnl # the owner as a thread_info pointer when CONFIG_DEBUG_MUTEXES -dnl # was defined. As of 2.6.39 this was changed to a task_struct -dnl # pointer which frankly makes a lot more sense. -dnl # -AC_DEFUN([SPL_AC_MUTEX_OWNER_TASK_STRUCT], [ - AC_MSG_CHECKING([whether struct mutex owner is a task_struct]) - tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Werror" - SPL_LINUX_TRY_COMPILE([ - #include - #include - ],[ - struct mutex mtx __attribute__ ((unused)); - mtx.owner = current; - ],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_MUTEX_OWNER_TASK_STRUCT, 1, - [struct mutex owner is a task_struct]) - ],[ - AC_MSG_RESULT(no) - ]) - EXTRA_KCFLAGS="$tmp_flags" -]) - dnl # dnl # 3.10 API change, dnl # PDE is replaced by PDE_DATA -- cgit v1.2.3