mirror_zfs/include
Matthew Ahrens be5c6d9653
Only examine best metaslabs on each vdev
On a system with very high fragmentation, we may need to do lots of gang
allocations (e.g. most indirect block allocations (~50KB) may need to
gang). Before failing a "normal" allocation and resorting to ganging, we
try every metaslab.  This has the impact of loading every metaslab (not
a huge deal since we now typically keep all metaslabs loaded), and also
iterating over every metaslab for every failing allocation. If there are
many metaslabs (more than the typical ~200, e.g. due to vdev expansion
or very large vdevs), the CPU cost of this iteration can be very
impactful.  This iteration is done with the mg_lock held, creating long
hold times and high lock contention for concurrent allocations,
ultimately causing long txg sync times and poor application performance.

To address this, this commit changes the behavior of "normal" (not
try_hard, not ZIL) allocations.  These will now only examine the 100
best metaslabs (as determined by their ms_weight).  If none of these
have a large enough free segment, then the allocation will fail and
we'll fall back on ganging.

To accomplish this, we will now (normally) gang before doing a
`try_hard` allocation.  Non-try_hard allocations will only examine the
100 best metaslabs of each vdev.  In summary, we will first try normal
allocation.  If that fails then we will do a gang allocation.  If that
fails then we will do a "try hard" gang allocation.  If that fails then
we will have a multi-layer gang block.

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
Closes #11327
2020-12-16 14:40:05 -08:00
..
os FreeBSD: Implement sysctl for fletcher4 impl 2020-12-11 10:29:01 -08:00
sys Only examine best metaslabs on each vdev 2020-12-16 14:40:05 -08:00
.gitignore OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
cityhash.h Compile cityhash code into libzfs 2020-03-27 09:11:22 -07:00
libnvpair.h Add JSON output support to channel programs 2018-03-19 12:40:58 -07:00
libuutil_common.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
libuutil_impl.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
libuutil.h Correct cppcheck errors 2017-09-19 12:17:29 -07:00
libzfs_core.h zfs label bootenv should store data as nvlist 2020-09-15 15:42:27 -07:00
libzfs_impl.h Add 'zfs rename -u' to rename without remounting 2020-09-01 16:14:16 -07:00
libzfs.h zpool: correctly align columns with -p 2020-11-16 09:26:20 -08:00
libzfsbootenv.h zfs label bootenv should store data as nvlist 2020-09-15 15:42:27 -07:00
libzutil.h Add prototypes 2020-06-18 12:21:32 -07:00
Makefile.am zfs label bootenv should store data as nvlist 2020-09-15 15:42:27 -07:00
thread_pool.h Add libtpool (thread pools) 2017-08-09 15:31:08 -07:00
zfeature_common.h Distributed Spare (dRAID) Feature 2020-11-13 13:51:51 -08:00
zfs_comutil.h Fix "zpool add -n" for dedup, special and log devices 2020-01-06 15:40:06 -08:00
zfs_deleg.h Remove code for zfs remap 2019-06-24 16:44:01 -07:00
zfs_fletcher.h Add AVX512BW variant of fletcher 2019-10-30 12:26:14 -07:00
zfs_namecheck.h Implement bookmark copying 2020-02-11 13:19:12 -08:00
zfs_prop.h Add zfs module feature and property info to sysfs 2018-09-02 12:09:53 -07:00