mirror_zfs/module/zfs
Matthew Ahrens 9cdf7b1f6b
Improve zfs destroy performance with zio_t-free zio_free()
When "zfs destroy" is run, it completes quickly, and in the background
we locate the blocks to free and free them.  This background activity
can be observed with `zpool get freeing` and `zpool wait -t free ...`.

This background activity is processed by a single thread (the spa_sync
thread) which calls zio_free() on each of the blocks to free.  With even
modest storage performance, the CPU consumption of zio_free() can be the
performance bottleneck.

Performance of zio_free() can be improved by not actually creating a
zio_t in the common case (non-dedup, non-gang), instead calling
metaslab_free() directly.  This avoids the CPU cost of allocating the
zio_t, and more importantly the cost of adding and later removing this
zio_t from the parent zio's child list.

The result is that performance of background freeing more than doubles,
from 0.6 million blocks per second to 1.3 million blocks per second.

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Wilson <gwilson@delphix.com>
Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
Closes #10034
2020-02-28 14:49:44 -08:00
..
aggsum.c Reduce number of atomic_add() calls in aggsum 2020-02-06 13:21:06 -08:00
arc.c Improve zfs destroy performance with zio_t-free zio_free() 2020-02-28 14:49:44 -08:00
blkptr.c
bplist.c
bpobj.c Add subcommand to wait for background zfs activity to complete 2019-09-13 18:09:06 -07:00
bptree.c
bqueue.c
btree.c Replace ASSERTV macro with compiler annotation 2019-12-05 12:37:00 -08:00
cityhash.c
dataset_kstats.c
dbuf_stats.c
dbuf.c Consolidate arc_buf allocation checks 2020-02-27 17:12:44 -08:00
ddt_zap.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
ddt.c Reduce loaded range tree memory usage 2019-10-09 10:36:03 -07:00
dmu_diff.c Mark write_record static 2019-12-03 09:51:44 -08:00
dmu_object.c
dmu_objset.c Improve zfs destroy performance with zio_t-free zio_free() 2020-02-28 14:49:44 -08:00
dmu_recv.c async zvol minor node creation interferes with receive 2020-02-03 09:33:14 -08:00
dmu_redact.c
dmu_send.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
dmu_traverse.c
dmu_tx.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
dmu_zfetch.c
dmu.c Remove zfs_getattr and convoff dead code 2020-02-24 15:38:22 -08:00
dnode_sync.c Convert dbuf dirty record record list to a list_t 2020-02-05 11:07:19 -08:00
dnode.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
dsl_bookmark.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
dsl_crypt.c Remove dead code error handling from dsl_crypt.c 2020-02-25 15:59:29 -08:00
dsl_dataset.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
dsl_deadlist.c Reduce loaded range tree memory usage 2019-10-09 10:36:03 -07:00
dsl_deleg.c Reduce loaded range tree memory usage 2019-10-09 10:36:03 -07:00
dsl_destroy.c Replace ASSERTV macro with compiler annotation 2019-12-05 12:37:00 -08:00
dsl_dir.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
dsl_pool.c Eliminate Linux specific inode usage from common code 2019-12-11 11:53:57 -08:00
dsl_prop.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
dsl_scan.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
dsl_synctask.c Fix typos in module/zfs/ 2019-09-02 17:56:41 -07:00
dsl_userhold.c Fix strdup conflict on other platforms 2019-10-10 09:47:06 -07:00
edonr_zfs.c
fm.c Enable zpool events tunables and tests on FreeBSD 2020-02-18 11:22:56 -08:00
gzip.c
hkdf.c
lz4.c Enable clang to use intrinsics for lz4 2019-10-01 13:17:32 -07:00
lzjb.c
Makefile.in Support setting user properties in a channel program 2020-02-14 13:41:42 -08:00
metaslab.c Replace ASSERTV macro with compiler annotation 2019-12-05 12:37:00 -08:00
mmp.c Improve zfs destroy performance with zio_t-free zio_free() 2020-02-28 14:49:44 -08:00
multilist.c Enable use of DTRACE_PROBE* macros in "spl" module 2019-11-01 13:13:43 -07:00
objlist.c
pathname.c
range_tree.c Function name and comment updates 2019-10-11 10:13:21 -07:00
refcount.c
rrwlock.c Enable use of DTRACE_PROBE* macros in "spl" module 2019-11-01 13:13:43 -07:00
sa.c Replace ASSERTV macro with compiler annotation 2019-12-05 12:37:00 -08:00
sha256.c
skein_zfs.c
spa_boot.c
spa_checkpoint.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
spa_config.c Add zfs_file_* interface, remove vnodes 2019-11-21 09:32:57 -08:00
spa_errlog.c
spa_history.c Fix strdup conflict on other platforms 2019-10-10 09:47:06 -07:00
spa_log_spacemap.c
spa_misc.c Share some code for spa deadman tunables 2020-02-10 13:11:30 -08:00
spa.c Improve zfs destroy performance with zio_t-free zio_free() 2020-02-28 14:49:44 -08:00
space_map.c Reduce loaded range tree memory usage 2019-10-09 10:36:03 -07:00
space_reftree.c Reduce loaded range tree memory usage 2019-10-09 10:36:03 -07:00
THIRDPARTYLICENSE.cityhash OpenZFS 8484 - Implement aggregate sum and use for arc counters 2018-06-06 09:35:59 -07:00
THIRDPARTYLICENSE.cityhash.descrip
txg.c Replace ASSERTV macro with compiler annotation 2019-12-05 12:37:00 -08:00
uberblock.c
unique.c Reduce loaded range tree memory usage 2019-10-09 10:36:03 -07:00
vdev_cache.c Replace ASSERTV macro with compiler annotation 2019-12-05 12:37:00 -08:00
vdev_indirect_births.c
vdev_indirect_mapping.c Replace ASSERTV macro with compiler annotation 2019-12-05 12:37:00 -08:00
vdev_indirect.c Replace ASSERTV macro with compiler annotation 2019-12-05 12:37:00 -08:00
vdev_initialize.c Linux 5.6 compat: time_t 2020-02-27 09:31:02 -08:00
vdev_label.c Add zfs_file_* interface, remove vnodes 2019-11-21 09:32:57 -08:00
vdev_mirror.c Avoid some crashes when importing a pool with corrupt metadata 2019-12-26 10:57:05 -08:00
vdev_missing.c
vdev_queue.c Reduce loaded range tree memory usage 2019-10-09 10:36:03 -07:00
vdev_raidz_math_aarch64_neon_common.h Minor performance fix for NEON RAID-Z 2019-12-17 19:34:52 -08:00
vdev_raidz_math_aarch64_neon.c
vdev_raidz_math_aarch64_neonx2.c
vdev_raidz_math_avx2.c
vdev_raidz_math_avx512bw.c
vdev_raidz_math_avx512f.c Make clang happy with vdev_raidz_ code 2019-10-10 09:45:37 -07:00
vdev_raidz_math_impl.h Fix const-correctness in raidz math 2020-02-03 10:52:41 -08:00
vdev_raidz_math_powerpc_altivec_common.h Add AltiVec RAID-Z 2020-01-23 11:01:24 -08:00
vdev_raidz_math_powerpc_altivec.c Add AltiVec RAID-Z 2020-01-23 11:01:24 -08:00
vdev_raidz_math_scalar.c
vdev_raidz_math_sse2.c Make clang happy with vdev_raidz_ code 2019-10-10 09:45:37 -07:00
vdev_raidz_math_ssse3.c
vdev_raidz_math.c Add AltiVec RAID-Z 2020-01-23 11:01:24 -08:00
vdev_raidz.c Reduce loaded range tree memory usage 2019-10-09 10:36:03 -07:00
vdev_removal.c Cancel initialize and TRIM before vdev_metaslab_fini() 2019-12-26 10:50:23 -08:00
vdev_root.c
vdev_trim.c Linux 5.6 compat: time_t 2020-02-27 09:31:02 -08:00
vdev.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
zap_leaf.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
zap_micro.c Reduce loaded range tree memory usage 2019-10-09 10:36:03 -07:00
zap.c
zcp_get.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
zcp_global.c
zcp_iter.c
zcp_set.c Support setting user properties in a channel program 2020-02-14 13:41:42 -08:00
zcp_synctask.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
zcp.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
zfeature.c Replace ASSERTV macro with compiler annotation 2019-12-05 12:37:00 -08:00
zfs_byteswap.c
zfs_fm.c
zfs_fuid.c Relocate common quota functions to shared code 2019-12-11 12:12:08 -08:00
zfs_ioctl.c Refactor dnode dirty context from dbuf_dirty 2020-02-26 16:09:17 -08:00
zfs_log.c Fix zfs_xattr_owner_unlinked on FreeBSD and comment 2019-12-16 09:49:05 -08:00
zfs_onexit.c Move zfs_onexit_fd_hold to platform code 2019-10-13 19:19:39 -07:00
zfs_quota.c Relocate common quota functions to shared code 2019-12-11 12:12:08 -08:00
zfs_ratelimit.c
zfs_replay.c Simplify FreeBSD's locking requirements in zfs_replay.c 2020-01-22 17:55:56 -08:00
zfs_rlock.c Move platform specific parts of zfs_znode.h to platform code 2019-11-06 10:54:25 -08:00
zfs_sa.c Add inode accessors to common code 2019-10-02 09:15:12 -07:00
zil.c Improve logging of 128KB writes 2019-11-11 09:27:59 -08:00
zio_checksum.c Disable EDONR on FreeBSD 2019-12-05 13:10:29 -08:00
zio_compress.c zio_decompress_data always ASSERTs successful decompression 2019-12-10 15:51:58 -08:00
zio_inject.c Replace ASSERTV macro with compiler annotation 2019-12-05 12:37:00 -08:00
zio.c Improve zfs destroy performance with zio_t-free zio_free() 2020-02-28 14:49:44 -08:00
zle.c
zrlock.c Enable use of DTRACE_PROBE* macros in "spl" module 2019-11-01 13:13:43 -07:00
zthr.c
zvol.c async zvol minor node creation interferes with receive 2020-02-03 09:33:14 -08:00