mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-06-01 03:34:10 +03:00
ARC: Pre-convert zfs_arc_min_prefetch_ms
There is no need to do MSEC_TO_TICK() for each evicted ARC header. We can do it when tunables are set, since we already have separate internal variables for those. Reviewed-by: Rob Norris <robn@despairlabs.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com> Closes #17965
This commit is contained in:
committed by
Tony Hutter
parent
6482a27e81
commit
5e0f20088d
+11
-13
@@ -406,8 +406,8 @@ uint_t arc_no_grow_shift = 5;
|
|||||||
* minimum lifespan of a prefetch block in clock ticks
|
* minimum lifespan of a prefetch block in clock ticks
|
||||||
* (initialized in arc_init())
|
* (initialized in arc_init())
|
||||||
*/
|
*/
|
||||||
static uint_t arc_min_prefetch_ms;
|
static uint_t arc_min_prefetch;
|
||||||
static uint_t arc_min_prescient_prefetch_ms;
|
static uint_t arc_min_prescient_prefetch;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this percent of memory is free, don't throttle.
|
* If this percent of memory is free, don't throttle.
|
||||||
@@ -3766,8 +3766,6 @@ arc_evict_hdr(arc_buf_hdr_t *hdr, uint64_t *real_evicted)
|
|||||||
{
|
{
|
||||||
arc_state_t *evicted_state, *state;
|
arc_state_t *evicted_state, *state;
|
||||||
int64_t bytes_evicted = 0;
|
int64_t bytes_evicted = 0;
|
||||||
uint_t min_lifetime = HDR_PRESCIENT_PREFETCH(hdr) ?
|
|
||||||
arc_min_prescient_prefetch_ms : arc_min_prefetch_ms;
|
|
||||||
|
|
||||||
ASSERT(MUTEX_HELD(HDR_LOCK(hdr)));
|
ASSERT(MUTEX_HELD(HDR_LOCK(hdr)));
|
||||||
ASSERT(HDR_HAS_L1HDR(hdr));
|
ASSERT(HDR_HAS_L1HDR(hdr));
|
||||||
@@ -3824,9 +3822,10 @@ arc_evict_hdr(arc_buf_hdr_t *hdr, uint64_t *real_evicted)
|
|||||||
((state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost);
|
((state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost);
|
||||||
|
|
||||||
/* prefetch buffers have a minimum lifespan */
|
/* prefetch buffers have a minimum lifespan */
|
||||||
|
uint_t min_lifetime = HDR_PRESCIENT_PREFETCH(hdr) ?
|
||||||
|
arc_min_prescient_prefetch : arc_min_prefetch;
|
||||||
if ((hdr->b_flags & (ARC_FLAG_PREFETCH | ARC_FLAG_INDIRECT)) &&
|
if ((hdr->b_flags & (ARC_FLAG_PREFETCH | ARC_FLAG_INDIRECT)) &&
|
||||||
ddi_get_lbolt() - hdr->b_l1hdr.b_arc_access <
|
ddi_get_lbolt() - hdr->b_l1hdr.b_arc_access < min_lifetime) {
|
||||||
MSEC_TO_TICK(min_lifetime)) {
|
|
||||||
ARCSTAT_BUMP(arcstat_evict_skip);
|
ARCSTAT_BUMP(arcstat_evict_skip);
|
||||||
return (bytes_evicted);
|
return (bytes_evicted);
|
||||||
}
|
}
|
||||||
@@ -4838,8 +4837,7 @@ arc_evict_cb_check(void *arg, zthr_t *zthr)
|
|||||||
*/
|
*/
|
||||||
return ((zfs_refcount_count(&arc_uncached->arcs_esize[ARC_BUFC_DATA]) +
|
return ((zfs_refcount_count(&arc_uncached->arcs_esize[ARC_BUFC_DATA]) +
|
||||||
zfs_refcount_count(&arc_uncached->arcs_esize[ARC_BUFC_METADATA]) &&
|
zfs_refcount_count(&arc_uncached->arcs_esize[ARC_BUFC_METADATA]) &&
|
||||||
ddi_get_lbolt() - arc_last_uncached_flush >
|
ddi_get_lbolt() - arc_last_uncached_flush > arc_min_prefetch / 2));
|
||||||
MSEC_TO_TICK(arc_min_prefetch_ms / 2)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -7593,12 +7591,12 @@ arc_tuning_update(boolean_t verbose)
|
|||||||
|
|
||||||
/* Valid range: 1 - N ms */
|
/* Valid range: 1 - N ms */
|
||||||
if (zfs_arc_min_prefetch_ms)
|
if (zfs_arc_min_prefetch_ms)
|
||||||
arc_min_prefetch_ms = zfs_arc_min_prefetch_ms;
|
arc_min_prefetch = MSEC_TO_TICK(zfs_arc_min_prefetch_ms);
|
||||||
|
|
||||||
/* Valid range: 1 - N ms */
|
/* Valid range: 1 - N ms */
|
||||||
if (zfs_arc_min_prescient_prefetch_ms) {
|
if (zfs_arc_min_prescient_prefetch_ms) {
|
||||||
arc_min_prescient_prefetch_ms =
|
arc_min_prescient_prefetch =
|
||||||
zfs_arc_min_prescient_prefetch_ms;
|
MSEC_TO_TICK(zfs_arc_min_prescient_prefetch_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Valid range: 0 - 100 */
|
/* Valid range: 0 - 100 */
|
||||||
@@ -7982,8 +7980,8 @@ arc_init(void)
|
|||||||
list_create(&arc_evict_waiters, sizeof (arc_evict_waiter_t),
|
list_create(&arc_evict_waiters, sizeof (arc_evict_waiter_t),
|
||||||
offsetof(arc_evict_waiter_t, aew_node));
|
offsetof(arc_evict_waiter_t, aew_node));
|
||||||
|
|
||||||
arc_min_prefetch_ms = 1000;
|
arc_min_prefetch = MSEC_TO_TICK(1000);
|
||||||
arc_min_prescient_prefetch_ms = 6000;
|
arc_min_prescient_prefetch = MSEC_TO_TICK(6000);
|
||||||
|
|
||||||
#if defined(_KERNEL)
|
#if defined(_KERNEL)
|
||||||
arc_lowmem_init();
|
arc_lowmem_init();
|
||||||
|
|||||||
Reference in New Issue
Block a user