#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;
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);
* 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();
}
} 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;
}
* 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);
}
}