summaryrefslogtreecommitdiffstats
path: root/module/zfs/vdev_queue.c
diff options
context:
space:
mode:
authorAlexander Motin <[email protected]>2020-12-06 12:55:02 -0500
committerGitHub <[email protected]>2020-12-06 09:55:02 -0800
commit8136b9d73bda48771ab49b32272b7870b463e6fd (patch)
tree9d4fd5672a0f68568edf7e1416fd024c5f25e7fc /module/zfs/vdev_queue.c
parent6366ef22404ef1bd0ba26364905e19f2ec7df2a4 (diff)
Avoid some spa_has_pending_synctask() calls.
Since 8c4fb36a24 (PR #7795) spa_has_pending_synctask() started to take two more locks per write inside txg_all_lists_empty(). I am surprised those pool-wide locks are not contended, but still their operations are visible in CPU profiles under contended vdev lock. This commit slightly changes vdev_queue_max_async_writes() flow to not call the function if we are going to return max_active any way due to high amount of dirty data. It allows to save some CPU time exactly when the pool is busy. Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-By: Tom Caputi <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Closes #11280
Diffstat (limited to 'module/zfs/vdev_queue.c')
-rw-r--r--module/zfs/vdev_queue.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/module/zfs/vdev_queue.c b/module/zfs/vdev_queue.c
index 6f3c4208a..02040c3ee 100644
--- a/module/zfs/vdev_queue.c
+++ b/module/zfs/vdev_queue.c
@@ -338,14 +338,12 @@ vdev_queue_max_async_writes(spa_t *spa)
* Sync tasks correspond to interactive user actions. To reduce the
* execution time of those actions we push data out as fast as possible.
*/
- if (spa_has_pending_synctask(spa))
+ dirty = dp->dp_dirty_total;
+ if (dirty > max_bytes || spa_has_pending_synctask(spa))
return (zfs_vdev_async_write_max_active);
- dirty = dp->dp_dirty_total;
if (dirty < min_bytes)
return (zfs_vdev_async_write_min_active);
- if (dirty > max_bytes)
- return (zfs_vdev_async_write_max_active);
/*
* linear interpolation: