summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_buf.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2020-10-25 17:14:28 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2020-10-26 18:32:11 -0700
commitf83480d33b5be815d1f8b368b417cca26368028f (patch)
treea833053fe9b41af5f37d3db449f4cd9bffaf320f /fs/xfs/xfs_buf.c
parent1778dd1dfd308ad539ce483b30946067be863f7b (diff)
xfs: increase the default parallelism levels of pwork clientspwork-parallelism_2020-10-26
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>
Diffstat (limited to 'fs/xfs/xfs_buf.c')
-rw-r--r--fs/xfs/xfs_buf.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 4e4cf91f4f9f..f3ae327cc8f4 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -2384,3 +2384,37 @@ xfs_verify_magic16(
return false;
return dmagic == bp->b_ops->magic16[idx];
}
+
+/* Estimate the amount of parallelism available for a given device. */
+unsigned int
+xfs_buftarg_guess_threads(
+ struct xfs_buftarg *btp)
+{
+ int iomin;
+ int ioopt;
+
+ /*
+ * The device tells us that it is non-rotational, and we take that to
+ * mean there are no moving parts and that the device can handle all
+ * the CPUs throwing IO requests at it.
+ */
+ if (blk_queue_nonrot(btp->bt_bdev->bd_disk->queue))
+ return num_online_cpus();
+
+ /*
+ * The device has a preferred and minimum IO size that suggest a RAID
+ * setup, so infer the number of disks and assume that the parallelism
+ * is equal to the disk count.
+ */
+ iomin = bdev_io_min(btp->bt_bdev);
+ ioopt = bdev_io_opt(btp->bt_bdev);
+ if (iomin > 0 && ioopt > iomin)
+ return ioopt / iomin;
+
+ /*
+ * The device did not indicate that it has any capabilities beyond that
+ * of a rotating disk with a single drive head, so we estimate no
+ * parallelism at all.
+ */
+ return 1;
+}