diff options
author | Ned Bass <[email protected]> | 2013-11-01 13:37:58 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-11-04 09:49:24 -0800 |
commit | 184c6873874c350bfb0b74f9e08ec8d89750d603 (patch) | |
tree | 504643ad1332fce93a920b7e6bbb1b30cd216dbd /config | |
parent | 0f4b9a58063d95b4da26c64dab4054d6272e0973 (diff) |
Emulate illumos interface cv_timedwait_hires()
Needed for Illumos #3582. This interface is supposed to support
a variable-resolution timeout with nanosecond granularity. This
implementation rounds up to microsecond resolution, as nanosecond-
precision timing is rarely needed for real-world performance
tuning and may incur unnecessary busy-waiting. usleep_range() is
used if available, otherwise udelay() or msleep() are used
depending on the length of the delay interval.
Add flags from sys/callo.h as these are used to control the behavior of
cv_timedwait_hires(). Specifically,
CALLOUT_FLAG_ABSOLUTE
Normally, the expiration passed to the timeout API functions is
an expiration interval. If this flag is specified, then it is
interpreted as the expiration time itself.
CALLOUT_FLAG_ROUNDUP
Roundup the expiration time to the next resolution boundary. If this
flag is not specified, the expiration time is rounded down.
References:
https://www.illumos.org/issues/3582
illumos/illumos-gate@0689f76
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #304
Diffstat (limited to 'config')
-rw-r--r-- | config/spl-build.m4 | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/config/spl-build.m4 b/config/spl-build.m4 index f54c5b166..b0e334815 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -93,6 +93,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [ SPL_AC_RWSEM_SPINLOCK_IS_RAW SPL_AC_SCHED_RT_HEADER SPL_AC_2ARGS_VFS_GETATTR + SPL_AC_USLEEP_RANGE ]) AC_DEFUN([SPL_AC_MODULE_SYMVERS], [ @@ -2400,3 +2401,25 @@ AC_DEFUN([SPL_AC_2ARGS_VFS_GETATTR], [ ]) ]) ]) + +dnl # +dnl # 2.6.36 API compatibility. +dnl # Added usleep_range timer. +dnl # usleep_range is a finer precision implementation of msleep +dnl # designed to be a drop-in replacement for udelay where a precise +dnl # sleep / busy-wait is unnecessary. +dnl # +AC_DEFUN([SPL_AC_USLEEP_RANGE], [ + AC_MSG_CHECKING([whether usleep_range() is available]) + SPL_LINUX_TRY_COMPILE([ + #include <linux/delay.h> + ],[ + usleep_range(0, 0); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_USLEEP_RANGE, 1, + [usleep_range is available]) + ],[ + AC_MSG_RESULT(no) + ]) +]) |