aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Quigley <[email protected]>2016-05-06 12:35:52 -0400
committerBrian Behlendorf <[email protected]>2016-05-06 09:35:52 -0700
commitae6d0c601eb863f8275bf4ec841fbebf774c3d65 (patch)
tree0f6b6e0d17d8f6cd0f2b9a674170547a16a084ec
parent4b2a3e0c9d6bcdec1fd279e9bb3b7c4628cd7ba6 (diff)
OpenZFS 6672 - arc_reclaim_thread() should use gethrtime()
6672 arc_reclaim_thread() should use gethrtime() instead of ddi_get_lbolt() Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Prakash Surya <[email protected]> Reviewed by: Josef 'Jeff' Sipek <[email protected]> Reviewed by: Robert Mustacchi <[email protected]> Approved by: Dan McDonald <[email protected]> Ported-by: David Quigley <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/6672 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/571be5c Closes #4600
-rw-r--r--lib/libspl/include/sys/time.h9
-rw-r--r--module/zfs/arc.c10
2 files changed, 14 insertions, 5 deletions
diff --git a/lib/libspl/include/sys/time.h b/lib/libspl/include/sys/time.h
index 03da3f7e3..f05fcaa1c 100644
--- a/lib/libspl/include/sys/time.h
+++ b/lib/libspl/include/sys/time.h
@@ -58,6 +58,15 @@
#define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC))
#endif
+#ifndef NSEC2SEC
+#define NSEC2SEC(n) ((n) / (NANOSEC / SEC))
+#endif
+
+#ifndef SEC2NSEC
+#define SEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / SEC))
+#endif
+
+
typedef long long hrtime_t;
typedef struct timespec timestruc_t;
typedef struct timespec timespec_t;
diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index faed67aa4..89d11ef42 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -3430,7 +3430,7 @@ static void
arc_reclaim_thread(void)
{
fstrans_cookie_t cookie = spl_fstrans_mark();
- clock_t growtime = 0;
+ hrtime_t growtime = 0;
callb_cpr_t cpr;
CALLB_CPR_INIT(&cpr, &arc_reclaim_lock, callb_generic_cpr, FTAG);
@@ -3454,7 +3454,7 @@ arc_reclaim_thread(void)
* Wait at least zfs_grow_retry (default 5) seconds
* before considering growing.
*/
- growtime = ddi_get_lbolt() + (arc_grow_retry * hz);
+ growtime = gethrtime() + SEC2NSEC(arc_grow_retry);
arc_kmem_reap_now();
@@ -3473,7 +3473,7 @@ arc_reclaim_thread(void)
}
} else if (free_memory < arc_c >> arc_no_grow_shift) {
arc_no_grow = B_TRUE;
- } else if (ddi_get_lbolt() >= growtime) {
+ } else if (gethrtime() >= growtime) {
arc_no_grow = B_FALSE;
}
@@ -3506,8 +3506,8 @@ arc_reclaim_thread(void)
* even if we aren't being signalled)
*/
CALLB_CPR_SAFE_BEGIN(&cpr);
- (void) cv_timedwait_sig(&arc_reclaim_thread_cv,
- &arc_reclaim_lock, ddi_get_lbolt() + hz);
+ (void) cv_timedwait_hires(&arc_reclaim_thread_cv,
+ &arc_reclaim_lock, SEC2NSEC(1), MSEC2NSEC(1), 0);
CALLB_CPR_SAFE_END(&cpr, &arc_reclaim_lock);
}
}