Some improvements to metaslabs eviction
- Add old eviction for special and dedup metaslab classes. Those vdevs may be potentially big and fragmented with large metaslabs, while their asynchronous write pattern is not really different from normal class. It seems an omission to not evict old metaslabs from them. - If we have metaslab preload enabled, which means we are not too low on memory, do not evict active metaslabs even if they are not used for some time. Eviction of active metaslabs means we won't be able to write anything until we load them, that may take some time, that is straight opposite to metaslab preload goals. For small systems the memory saving should be less important after recent reduction in number of allocators and so open metaslabs. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #16214
This commit is contained in:
parent
ba3c7692cd
commit
13ccbbb47a
|
@ -640,6 +640,7 @@ void
|
||||||
metaslab_class_evict_old(metaslab_class_t *mc, uint64_t txg)
|
metaslab_class_evict_old(metaslab_class_t *mc, uint64_t txg)
|
||||||
{
|
{
|
||||||
multilist_t *ml = &mc->mc_metaslab_txg_list;
|
multilist_t *ml = &mc->mc_metaslab_txg_list;
|
||||||
|
hrtime_t now = gethrtime();
|
||||||
for (int i = 0; i < multilist_get_num_sublists(ml); i++) {
|
for (int i = 0; i < multilist_get_num_sublists(ml); i++) {
|
||||||
multilist_sublist_t *mls = multilist_sublist_lock_idx(ml, i);
|
multilist_sublist_t *mls = multilist_sublist_lock_idx(ml, i);
|
||||||
metaslab_t *msp = multilist_sublist_head(mls);
|
metaslab_t *msp = multilist_sublist_head(mls);
|
||||||
|
@ -663,8 +664,10 @@ metaslab_class_evict_old(metaslab_class_t *mc, uint64_t txg)
|
||||||
multilist_sublist_unlock(mls);
|
multilist_sublist_unlock(mls);
|
||||||
if (txg >
|
if (txg >
|
||||||
msp->ms_selected_txg + metaslab_unload_delay &&
|
msp->ms_selected_txg + metaslab_unload_delay &&
|
||||||
gethrtime() > msp->ms_selected_time +
|
now > msp->ms_selected_time +
|
||||||
(uint64_t)MSEC2NSEC(metaslab_unload_delay_ms)) {
|
MSEC2NSEC(metaslab_unload_delay_ms) &&
|
||||||
|
(msp->ms_allocator == -1 ||
|
||||||
|
!metaslab_preload_enabled)) {
|
||||||
metaslab_evict(msp, txg);
|
metaslab_evict(msp, txg);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -9939,6 +9939,9 @@ spa_sync(spa_t *spa, uint64_t txg)
|
||||||
|
|
||||||
metaslab_class_evict_old(spa->spa_normal_class, txg);
|
metaslab_class_evict_old(spa->spa_normal_class, txg);
|
||||||
metaslab_class_evict_old(spa->spa_log_class, txg);
|
metaslab_class_evict_old(spa->spa_log_class, txg);
|
||||||
|
/* spa_embedded_log_class has only one metaslab per vdev. */
|
||||||
|
metaslab_class_evict_old(spa->spa_special_class, txg);
|
||||||
|
metaslab_class_evict_old(spa->spa_dedup_class, txg);
|
||||||
|
|
||||||
spa_sync_close_syncing_log_sm(spa);
|
spa_sync_close_syncing_log_sm(spa);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue