diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2019-08-30 15:44:39 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2019-10-09 09:39:17 -0700 |
commit | cc4a1cb5c4644e48cd42e8c1bb1f2e1388753cc3 (patch) | |
tree | 0f3d596944abc95864c6ecaf5faff1144e3dc51c | |
parent | f1e7e2d33012355a505f4a3a0ad6469603400074 (diff) |
xfs: increase the default parallelism levels of pwork clientspwork-parallelism_2019-10-09
Increase the default parallelism level for pwork clients so that we can
take advantage of computers with a lot of CPUs and a lot of hardware.
8x raid0 spinning rust running quotacheck:
1 39s
2 29s
4 26s
8 24s
24 (nr_cpus) 24s
4x raid0 sata ssds running quotacheck:
1 12s
2 12s
4 12s
8 13s
24 (nr_cpus) 14s
4x raid0 nvme ssds running quotacheck:
1 18s
2 18s
4 19s
8 20s
20 (nr_cpus) 20s
So, mixed results...
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-rw-r--r-- | fs/xfs/xfs_pwork.c | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/fs/xfs/xfs_pwork.c b/fs/xfs/xfs_pwork.c index 4bcc3e61056c..9589995a5137 100644 --- a/fs/xfs/xfs_pwork.c +++ b/fs/xfs/xfs_pwork.c @@ -127,10 +127,45 @@ xfs_pwork_guess_datadev_parallelism( struct xfs_mount *mp) { struct xfs_buftarg *btp = mp->m_ddev_targp; + unsigned int threads; + unsigned int max_threads; + int iomin; + int ioopt; /* - * For now we'll go with the most conservative setting possible, - * which is two threads for an SSD and 1 thread everywhere else. + * For metadata activities we probably can't scale further than the + * number of AGs and the number of online CPUs; and we must abide the + * workqueue maximum thread count. */ - return blk_queue_nonrot(btp->bt_bdev->bd_queue) ? 2 : 1; + max_threads = min(mp->m_sb.sb_agcount, + min_t(unsigned int, num_online_cpus(), WQ_MAX_ACTIVE)); + + if (blk_queue_nonrot(btp->bt_bdev->bd_queue)) { + threads = max_threads; + goto out; + } + + /* + * For filesystems on rotational storage with configured stripe width + * and stripe units, we assume that there's a multidisk setup (e.g. + * RAID) and that we can parallelise according to the setup's geometry. + * First we try the values in the superblock and then we resort to + * probing the block layer. + */ + if (mp->m_sb.sb_width && mp->m_sb.sb_unit) { + threads = mp->m_sb.sb_width / mp->m_sb.sb_unit; + goto out; + } + + iomin = bdev_io_min(btp->bt_bdev); + ioopt = bdev_io_opt(btp->bt_bdev); + if (iomin > 0 && ioopt > 0) { + threads = ioopt / iomin; + goto out; + } + + /* Unexciting rotating disks get one thread. */ + threads = 1; +out: + return clamp(threads, 1U, max_threads); } |