]> git.proxmox.com Git - mirror_zfs.git/commit - module/zfs/zio.c
Improve zfs destroy performance with zio_t-free zio_free()
authorMatthew Ahrens <mahrens@delphix.com>
Fri, 28 Feb 2020 22:49:44 +0000 (14:49 -0800)
committerGitHub <noreply@github.com>
Fri, 28 Feb 2020 22:49:44 +0000 (14:49 -0800)
commit9cdf7b1f6b00cdd0a31d07e3fbc679d0e9eff247
treee94d73d90ddd9fa6ba64207dfbbe706f24974976
parent6c0abcfddd4dcf8ef62e84cfa3b77c14e146827d
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
cmd/zdb/zdb.c
module/zfs/arc.c
module/zfs/dmu_objset.c
module/zfs/mmp.c
module/zfs/spa.c
module/zfs/zio.c