]> git.proxmox.com Git - mirror_zfs.git/commit - man/man4/zfs.4
Cap metaslab memory usage
authorPaul Dagnelie <pcd@delphix.com>
Fri, 16 Aug 2019 15:08:21 +0000 (08:08 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 16 Aug 2019 15:08:21 +0000 (09:08 -0600)
commitf09fda5071813751ba3fa77c28e588689795e17e
tree164564e5c5a88412d05477214c06cda69f929858
parent9323aad14d2f99d6fff1e50cce25fa6361495ec4
Cap metaslab memory usage

On systems with large amounts of storage and high fragmentation, a huge
amount of space can be used by storing metaslab range trees. Since
metaslabs are only unloaded during a txg sync, and only if they have
been inactive for 8 txgs, it is possible to get into a state where all
of the system's memory is consumed by range trees and metaslabs, and
txgs cannot sync. While ZFS knows how to evict ARC data when needed,
it has no such mechanism for range tree data. This can result in boot
hangs for some system configurations.

First, we add the ability to unload metaslabs outside of syncing
context. Second, we store a multilist of all loaded metaslabs, sorted
by their selection txg, so we can quickly identify the oldest
metaslabs.  We use a multilist to reduce lock contention during heavy
write workloads. Finally, we add logic that will unload a metaslab
when we're loading a new metaslab, if we're using more than a certain
fraction of the available memory on range trees.

Reviewed-by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: George Wilson <gwilson@delphix.com>
Reviewed-by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #9128
include/sys/arc.h
include/sys/metaslab.h
include/sys/metaslab_impl.h
man/man5/zfs-module-parameters.5
module/zfs/arc.c
module/zfs/metaslab.c
module/zfs/spa.c
module/zfs/spa_log_spacemap.c
module/zfs/vdev.c
module/zfs/vdev_initialize.c
module/zfs/vdev_trim.c