summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2016-03-08 18:28:24 +0000
committermav <mav@FreeBSD.org>2016-03-08 18:28:24 +0000
commit6126cff85dfba5b780bf4375556534db410c3529 (patch)
tree2fda746a1df8bfe6af3fb5fe61e5a2f2c0867973
parent2ad69bb39b85e2c0ebe93a129ec61a5d1aa71407 (diff)
downloadFreeBSD-src-6126cff85dfba5b780bf4375556534db410c3529.zip
FreeBSD-src-6126cff85dfba5b780bf4375556534db410c3529.tar.gz
MFV r296529:
6672 arc_reclaim_thread() should use gethrtime() instead of ddi_get_lbolt() 6673 want a macro to convert seconds to nanoseconds and vice-versa Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Prakash Surya <prakash.surya@delphix.com> Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net> Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Dan McDonald <danmcd@omniti.com> Author: Eli Rosenthal <eli.rosenthal@delphix.com> illumos/illumos-gate@a8f6344fa0921599e1f4511e41b5f9a25c38c0f9
-rw-r--r--sys/cddl/compat/opensolaris/sys/time.h3
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c10
2 files changed, 8 insertions, 5 deletions
diff --git a/sys/cddl/compat/opensolaris/sys/time.h b/sys/cddl/compat/opensolaris/sys/time.h
index b54780c..6116d5b 100644
--- a/sys/cddl/compat/opensolaris/sys/time.h
+++ b/sys/cddl/compat/opensolaris/sys/time.h
@@ -40,6 +40,9 @@
#define MSEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MILLISEC))
#define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC))
+#define NSEC2SEC(n) ((n) / (NANOSEC / SEC))
+#define SEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / SEC))
+
typedef longlong_t hrtime_t;
#if defined(__i386__) || defined(__powerpc__)
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
index fad9874..f944903 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
@@ -3606,7 +3606,7 @@ arc_kmem_reap_now(void)
static void
arc_reclaim_thread(void *dummy __unused)
{
- clock_t growtime = 0;
+ hrtime_t growtime = 0;
callb_cpr_t cpr;
CALLB_CPR_INIT(&cpr, &arc_reclaim_lock, callb_generic_cpr, FTAG);
@@ -3627,7 +3627,7 @@ arc_reclaim_thread(void *dummy __unused)
* Wait at least zfs_grow_retry (default 60) seconds
* before considering growing.
*/
- growtime = ddi_get_lbolt() + (arc_grow_retry * hz);
+ growtime = gethrtime() + SEC2NSEC(arc_grow_retry);
arc_kmem_reap_now();
@@ -3647,7 +3647,7 @@ arc_reclaim_thread(void *dummy __unused)
}
} 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;
}
@@ -3681,8 +3681,8 @@ arc_reclaim_thread(void *dummy __unused)
* even if we aren't being signalled)
*/
CALLB_CPR_SAFE_BEGIN(&cpr);
- (void) cv_timedwait(&arc_reclaim_thread_cv,
- &arc_reclaim_lock, 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);
}
}
OpenPOWER on IntegriCloud