Skip to content

Commit

Permalink
Avoid some spa_has_pending_synctask() calls.
Browse files Browse the repository at this point in the history
Since 8c4fb36 (PR openzfs#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 <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-By: Tom Caputi <caputit1@tcnj.edu>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Closes openzfs#11280
  • Loading branch information
amotin authored and jsai20 committed Mar 30, 2021
1 parent d999723 commit 7502025
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions module/zfs/vdev_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 7502025

Please sign in to comment.