mirror_zfs/module
Paul Dagnelie c81f1790e2 Metaslab max_size should be persisted while unloaded
When we unload metaslabs today in ZFS, the cached max_size value is
discarded. We instead use the histogram to determine whether or not we
think we can satisfy an allocation from the metaslab. This can result in
situations where, if we're doing I/Os of a size not aligned to a
histogram bucket, a metaslab is loaded even though it cannot satisfy the
allocation we think it can. For example, a metaslab with 16 entries in
the 16k-32k bucket may have entirely 16kB entries. If we try to allocate
a 24kB buffer, we will load that metaslab because we think it should be
able to handle the allocation. Doing so is expensive in CPU time, disk
reads, and average IO latency. This is exacerbated if the write being
attempted is a sync write.

This change makes ZFS cache the max_size after the metaslab is
unloaded. If we ever get a free (or a coalesced group of frees) larger
than the max_size, we will update it. Otherwise, we leave it as is. When
attempting to allocate, we use the max_size as a lower bound, and
respect it unless we are in try_hard. However, we do age the max_size
out at some point, since we expect the actual max_size to increase as we
do more frees. A more sophisticated algorithm here might be helpful, but
this works reasonably well.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matt Ahrens <mahrens@delphix.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #9055
2019-08-05 14:34:27 -07:00
..
avl Update build system and packaging 2018-05-29 16:00:33 -07:00
icp Minor style cleanup 2019-07-16 17:22:31 -07:00
lua Fix channel programs on s390x 2019-07-28 18:15:26 -07:00
nvpair Use NV_ENCODE_NATIVE for nvlist encoding variable 2019-04-26 11:24:31 -07:00
spl Retire unused spl_{mutex,rwlock}_{init_fini} 2019-07-17 15:13:53 -07:00
unicode Update build system and packaging 2018-05-29 16:00:33 -07:00
zcommon Fast Clone Deletion 2019-07-26 10:54:14 -07:00
zfs Metaslab max_size should be persisted while unloaded 2019-08-05 14:34:27 -07:00
.gitignore Prepare SPL repo to merge with ZFS repo 2018-05-29 14:51:39 -07:00
Makefile.in Fix out-of-tree build failures 2019-06-24 09:32:47 -07:00