diff options
author | Matthew Ahrens <[email protected]> | 2020-03-03 10:29:38 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-03 10:29:38 -0800 |
commit | b3212d2fa6ab8d7d8373373e8a6b8acbbf45508e (patch) | |
tree | 2e5fc480593300e98addaea9959405cf4e4bf7bb /module/zfs | |
parent | 0a0f9a7dc6e4f215089cf0aabb230d5dd5dfbd1e (diff) |
Improve performance of zio_taskq_member
__zio_execute() calls zio_taskq_member() to determine if we are running
in a zio interrupt taskq, in which case we may need to switch to
processing this zio in a zio issue taskq. The call to
zio_taskq_member() can become a performance bottleneck when we are
processing a high rate of zio's.
zio_taskq_member() calls taskq_member() on each of the zio interrupt
taskqs, of which there are 21. This is slow because each call to
taskq_member() does tsd_get(taskq_tsd), which on Linux is relatively
slow.
This commit improves the performance of zio_taskq_member() by having it
cache the value of tsd_get(taskq_tsd), reducing the number of those
calls to 1/21th of the current behavior.
In a test case running `zfs send -c >/dev/null` of a filesystem with
small blocks (average 2.5KB/block), zio_taskq_member() was using 6.7% of
one CPU, and with this change it is reduced to 1.3%. Overall time to
perform the `zfs send` reduced by 10% (~150,000 block/sec to ~165,000
blocks/sec).
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Serapheim Dimitropoulos <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Tony Nguyen <[email protected]>
Signed-off-by: Matthew Ahrens <[email protected]>
Closes #10070
Diffstat (limited to 'module/zfs')
-rw-r--r-- | module/zfs/zio.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/module/zfs/zio.c b/module/zfs/zio.c index cbe6fc751..bf6b5afab 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -1865,14 +1865,15 @@ zio_taskq_dispatch(zio_t *zio, zio_taskq_type_t q, boolean_t cutinline) static boolean_t zio_taskq_member(zio_t *zio, zio_taskq_type_t q) { - kthread_t *executor = zio->io_executor; spa_t *spa = zio->io_spa; + taskq_t *tq = taskq_of_curthread(); + for (zio_type_t t = 0; t < ZIO_TYPES; t++) { spa_taskqs_t *tqs = &spa->spa_zio_taskq[t][q]; uint_t i; for (i = 0; i < tqs->stqs_count; i++) { - if (taskq_member(tqs->stqs_taskq[i], executor)) + if (tqs->stqs_taskq[i] == tq) return (B_TRUE); } } |