diff options
-rwxr-xr-x | cmd/arc_summary | 5 | ||||
-rw-r--r-- | include/sys/arc_impl.h | 1 | ||||
-rw-r--r-- | module/zfs/arc.c | 13 | ||||
-rw-r--r-- | module/zfs/dbuf.c | 12 |
4 files changed, 16 insertions, 15 deletions
diff --git a/cmd/arc_summary b/cmd/arc_summary index c24d400fa..72381d266 100755 --- a/cmd/arc_summary +++ b/cmd/arc_summary @@ -662,10 +662,7 @@ def section_arc(kstats_dict): print() print('ARC hash breakdown:') - prt_i1('Elements max:', f_hits(arc_stats['hash_elements_max'])) - prt_i2('Elements current:', - f_perc(arc_stats['hash_elements'], arc_stats['hash_elements_max']), - f_hits(arc_stats['hash_elements'])) + prt_i1('Elements:', f_hits(arc_stats['hash_elements'])) prt_i1('Collisions:', f_hits(arc_stats['hash_collisions'])) prt_i1('Chain max:', f_hits(arc_stats['hash_chain_max'])) diff --git a/include/sys/arc_impl.h b/include/sys/arc_impl.h index 01693d72d..b2839bdf1 100644 --- a/include/sys/arc_impl.h +++ b/include/sys/arc_impl.h @@ -942,6 +942,7 @@ typedef struct arc_sums { wmsum_t arcstat_evict_l2_eligible_mru; wmsum_t arcstat_evict_l2_ineligible; wmsum_t arcstat_evict_l2_skip; + wmsum_t arcstat_hash_elements; wmsum_t arcstat_hash_collisions; wmsum_t arcstat_hash_chains; aggsum_t arcstat_size; diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 2ece7d677..0c086fc21 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -1074,12 +1074,9 @@ buf_hash_insert(arc_buf_hdr_t *hdr, kmutex_t **lockp) ARCSTAT_BUMP(arcstat_hash_collisions); if (i == 1) ARCSTAT_BUMP(arcstat_hash_chains); - ARCSTAT_MAX(arcstat_hash_chain_max, i); } - uint64_t he = atomic_inc_64_nv( - &arc_stats.arcstat_hash_elements.value.ui64); - ARCSTAT_MAX(arcstat_hash_elements_max, he); + ARCSTAT_BUMP(arcstat_hash_elements); return (NULL); } @@ -1103,8 +1100,7 @@ buf_hash_remove(arc_buf_hdr_t *hdr) arc_hdr_clear_flags(hdr, ARC_FLAG_IN_HASH_TABLE); /* collect some hash table performance data */ - atomic_dec_64(&arc_stats.arcstat_hash_elements.value.ui64); - + ARCSTAT_BUMPDOWN(arcstat_hash_elements); if (buf_hash_table.ht_table[idx] && buf_hash_table.ht_table[idx]->b_hash_next == NULL) ARCSTAT_BUMPDOWN(arcstat_hash_chains); @@ -7008,6 +7004,9 @@ arc_kstat_update(kstat_t *ksp, int rw) wmsum_value(&arc_sums.arcstat_evict_l2_ineligible); as->arcstat_evict_l2_skip.value.ui64 = wmsum_value(&arc_sums.arcstat_evict_l2_skip); + as->arcstat_hash_elements.value.ui64 = + as->arcstat_hash_elements_max.value.ui64 = + wmsum_value(&arc_sums.arcstat_hash_elements); as->arcstat_hash_collisions.value.ui64 = wmsum_value(&arc_sums.arcstat_hash_collisions); as->arcstat_hash_chains.value.ui64 = @@ -7432,6 +7431,7 @@ arc_state_init(void) wmsum_init(&arc_sums.arcstat_evict_l2_eligible_mru, 0); wmsum_init(&arc_sums.arcstat_evict_l2_ineligible, 0); wmsum_init(&arc_sums.arcstat_evict_l2_skip, 0); + wmsum_init(&arc_sums.arcstat_hash_elements, 0); wmsum_init(&arc_sums.arcstat_hash_collisions, 0); wmsum_init(&arc_sums.arcstat_hash_chains, 0); aggsum_init(&arc_sums.arcstat_size, 0); @@ -7590,6 +7590,7 @@ arc_state_fini(void) wmsum_fini(&arc_sums.arcstat_evict_l2_eligible_mru); wmsum_fini(&arc_sums.arcstat_evict_l2_ineligible); wmsum_fini(&arc_sums.arcstat_evict_l2_skip); + wmsum_fini(&arc_sums.arcstat_hash_elements); wmsum_fini(&arc_sums.arcstat_hash_collisions); wmsum_fini(&arc_sums.arcstat_hash_chains); aggsum_fini(&arc_sums.arcstat_size); diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 7b8fdaae0..cbd07d19a 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -89,7 +89,6 @@ typedef struct dbuf_stats { kstat_named_t hash_misses; kstat_named_t hash_collisions; kstat_named_t hash_elements; - kstat_named_t hash_elements_max; /* * Number of sublists containing more than one dbuf in the dbuf * hash table. Keep track of the longest hash chain. @@ -134,7 +133,6 @@ dbuf_stats_t dbuf_stats = { { "hash_misses", KSTAT_DATA_UINT64 }, { "hash_collisions", KSTAT_DATA_UINT64 }, { "hash_elements", KSTAT_DATA_UINT64 }, - { "hash_elements_max", KSTAT_DATA_UINT64 }, { "hash_chains", KSTAT_DATA_UINT64 }, { "hash_chain_max", KSTAT_DATA_UINT64 }, { "hash_insert_race", KSTAT_DATA_UINT64 }, @@ -154,6 +152,7 @@ struct { wmsum_t hash_hits; wmsum_t hash_misses; wmsum_t hash_collisions; + wmsum_t hash_elements; wmsum_t hash_chains; wmsum_t hash_insert_race; wmsum_t metadata_cache_count; @@ -432,8 +431,7 @@ dbuf_hash_insert(dmu_buf_impl_t *db) db->db_hash_next = h->hash_table[idx]; h->hash_table[idx] = db; mutex_exit(DBUF_HASH_MUTEX(h, idx)); - uint64_t he = atomic_inc_64_nv(&dbuf_stats.hash_elements.value.ui64); - DBUF_STAT_MAX(hash_elements_max, he); + DBUF_STAT_BUMP(hash_elements); return (NULL); } @@ -506,7 +504,7 @@ dbuf_hash_remove(dmu_buf_impl_t *db) h->hash_table[idx]->db_hash_next == NULL) DBUF_STAT_BUMPDOWN(hash_chains); mutex_exit(DBUF_HASH_MUTEX(h, idx)); - atomic_dec_64(&dbuf_stats.hash_elements.value.ui64); + DBUF_STAT_BUMPDOWN(hash_elements); } typedef enum { @@ -903,6 +901,8 @@ dbuf_kstat_update(kstat_t *ksp, int rw) wmsum_value(&dbuf_sums.hash_misses); ds->hash_collisions.value.ui64 = wmsum_value(&dbuf_sums.hash_collisions); + ds->hash_elements.value.ui64 = + wmsum_value(&dbuf_sums.hash_elements); ds->hash_chains.value.ui64 = wmsum_value(&dbuf_sums.hash_chains); ds->hash_insert_race.value.ui64 = @@ -1004,6 +1004,7 @@ dbuf_init(void) wmsum_init(&dbuf_sums.hash_hits, 0); wmsum_init(&dbuf_sums.hash_misses, 0); wmsum_init(&dbuf_sums.hash_collisions, 0); + wmsum_init(&dbuf_sums.hash_elements, 0); wmsum_init(&dbuf_sums.hash_chains, 0); wmsum_init(&dbuf_sums.hash_insert_race, 0); wmsum_init(&dbuf_sums.metadata_cache_count, 0); @@ -1077,6 +1078,7 @@ dbuf_fini(void) wmsum_fini(&dbuf_sums.hash_hits); wmsum_fini(&dbuf_sums.hash_misses); wmsum_fini(&dbuf_sums.hash_collisions); + wmsum_fini(&dbuf_sums.hash_elements); wmsum_fini(&dbuf_sums.hash_chains); wmsum_fini(&dbuf_sums.hash_insert_race); wmsum_fini(&dbuf_sums.metadata_cache_count); |