Skip to contentSkip to conversation

Support disabling fair tag sharing

PATCH Superseded Bart Van Assche 4 participants 15 messages Oct 23, 2023 – Oct 31, 2023

Subsystems (3)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Bart Van Assche

author reviewer
#0 lore raw

v4 cover Support disabling fair tag sharing

Hi Jens,

Performance of UFS devices is reduced significantly by the fair tag sharing algorithm. This is because UFS devices have multiple logical units and a limited queue depth (32 for UFS 3.1 devices) and also because it takes time to give tags back after activity on a request queue has stopped. This patch series addresses this issue by introducing a flag that allows block drivers to disable fair sharing.

Please consider this patch series for the next merge window.

Thanks,

Bart.

Changes compared to v3:
- Instead of disabling fair tag sharing for all block drivers, introduce a flag for disabling it conditionally.

Changes between v2 and v3:
- Rebased on top of the latest kernel.

Changes between v1 and v2:
- Restored the tags->active_queues variable and thereby fixed the "uninitialized variable" warning reported by the kernel test robot.

Bart Van Assche (3):
block: Introduce flag BLK_MQ_F_DISABLE_FAIR_TAG_SHARING
scsi: core: Support disabling fair tag sharing
scsi: ufs: Disable fair tag sharing

 block/blk-mq-debugfs.c    | 1 +
 block/blk-mq.h            | 3 ++-
 drivers/scsi/hosts.c      | 1 +
 drivers/scsi/scsi_lib.c   | 2 ++
 drivers/ufs/core/ufshcd.c | 1 +
 include/linux/blk-mq.h    | 1 +
 include/scsi/scsi_host.h  | 6 ++++++
 7 files changed, 14 insertions(+), 1 deletion(-)
author reviewer
#1 lore raw

PATCH v4 1/3 block: Introduce flag BLK_MQ_F_DISABLE_FAIR_TAG_SHARING

The fair sharing algorithm has a negative performance impact for storage devices for which the full queue depth is required to reach peak performance, e.g. UFS devices. This is because it takes long after a request queue became inactive until tags are reassigned to the active request queue(s). Since making tag sharing fair is not needed if the request processing latency is similar for all request queues, introduce the hctx / tag set flag BLK_MQ_F_DISABLE_FAIR_TAG_SHARING.

Cc Cc: Christoph Hellwig <[email protected]>
Cc Martin K. Petersen <[email protected]>
Cc Ming Lei <[email protected]>
Cc Keith Busch <[email protected]>
Cc Damien Le Moal <[email protected]>
Cc Yu Kuai <[email protected]>
Cc Ed Tsai <[email protected]>
---
 block/blk-mq-debugfs.c | 1 +
 block/blk-mq.h         | 3 ++-
 include/linux/blk-mq.h | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)
block/blk-mq-debugfs.c +1 -0
index 5cbeb9344f2f..f41408103106 100644
@@ -198,6 +198,7 @@ static const char *const hctx_flag_name[] = {
 	HCTX_FLAG_NAME(NO_SCHED),
 	HCTX_FLAG_NAME(STACKING),
 	HCTX_FLAG_NAME(TAG_HCTX_SHARED),
+	HCTX_FLAG_NAME(DISABLE_FAIR_TAG_SHARING),
 };
 #undef HCTX_FLAG_NAME
 
block/blk-mq.h +2 -1
index f75a9ecfebde..eda6bd0611ea 100644
@@ -416,7 +416,8 @@ static inline bool hctx_may_queue(struct blk_mq_hw_ctx *hctx,
 {
 	unsigned int depth, users;
 
-	if (!hctx || !(hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED))
+	if (!hctx || !(hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED) ||
+	    (hctx->flags & BLK_MQ_F_DISABLE_FAIR_TAG_SHARING))
 		return true;
 
 	/*
include/linux/blk-mq.h +1 -0
index 1ab3081c82ed..b12a0be839aa 100644
@@ -662,6 +662,7 @@ enum {
 	 * or shared hwqs instead of 'mq-deadline'.
 	 */
 	BLK_MQ_F_NO_SCHED_BY_DEFAULT	= 1 << 7,
+	BLK_MQ_F_DISABLE_FAIR_TAG_SHARING = 1 << 8,
 	BLK_MQ_F_ALLOC_POLICY_START_BIT = 8,
 	BLK_MQ_F_ALLOC_POLICY_BITS = 1,
 
author reviewer
#2 lore raw

PATCH v4 2/3 scsi: core: Support disabling fair tag sharing

In reply to Bart Van Assche

Allow SCSI drivers to disable the block layer fair tag sharing algorithm.

Cc Christoph Hellwig <[email protected]>
Cc Martin K. Petersen <[email protected]>
Cc Ming Lei <[email protected]>
Cc Keith Busch <[email protected]>
Cc Damien Le Moal <[email protected]>
Cc Yu Kuai <[email protected]>
Cc Ed Tsai <[email protected]>
---
 drivers/scsi/hosts.c     | 1 +
 drivers/scsi/scsi_lib.c  | 2 ++
 include/scsi/scsi_host.h | 6 ++++++
 3 files changed, 9 insertions(+)
drivers/scsi/hosts.c +1 -0
index d7f51b84f3c7..872f87001374 100644
@@ -442,6 +442,7 @@ struct Scsi_Host *scsi_host_alloc(const struct scsi_host_template *sht, int priv
 	shost->no_write_same = sht->no_write_same;
 	shost->host_tagset = sht->host_tagset;
 	shost->queuecommand_may_block = sht->queuecommand_may_block;
+	shost->disable_fair_tag_sharing = sht->disable_fair_tag_sharing;
 
 	if (shost_eh_deadline == -1 || !sht->eh_host_reset_handler)
 		shost->eh_deadline = -1;
drivers/scsi/scsi_lib.c +2 -0
index c2f647a7c1b0..68683988c466 100644
@@ -1985,6 +1985,8 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost)
 		BLK_ALLOC_POLICY_TO_MQ_FLAG(shost->hostt->tag_alloc_policy);
 	if (shost->queuecommand_may_block)
 		tag_set->flags |= BLK_MQ_F_BLOCKING;
+	if (shost->disable_fair_tag_sharing)
+		tag_set->flags |= BLK_MQ_F_DISABLE_FAIR_TAG_SHARING;
 	tag_set->driver_data = shost;
 	if (shost->host_tagset)
 		tag_set->flags |= BLK_MQ_F_TAG_HCTX_SHARED;
include/scsi/scsi_host.h +6 -0
index 49f768d0ff37..2cd8a41b1f1c 100644
@@ -461,6 +461,9 @@ struct scsi_host_template {
 	/* The queuecommand callback may block. See also BLK_MQ_F_BLOCKING. */
 	unsigned queuecommand_may_block:1;
 
+	/* See also BLK_MQ_F_DISABLE_FAIR_TAG_SHARING. */
+	unsigned disable_fair_tag_sharing:1;
+
 	/*
 	 * Countdown for host blocking with no commands outstanding.
 	 */
@@ -659,6 +662,9 @@ struct Scsi_Host {
 	/* The queuecommand callback may block. See also BLK_MQ_F_BLOCKING. */
 	unsigned queuecommand_may_block:1;
 
+	/* See also BLK_MQ_F_DISABLE_FAIR_TAG_SHARING. */
+	unsigned disable_fair_tag_sharing:1;
+
 	/* Host responded with short (<36 bytes) INQUIRY result */
 	unsigned short_inquiry:1;
 
author reviewer
#3 lore raw

PATCH v4 3/3 scsi: ufs: Disable fair tag sharing

In reply to Bart Van Assche

Disable the block layer fair tag sharing algorithm because it significantly reduces performance of UFS devices with a maximum queue depth of 32.

Cc Christoph Hellwig <[email protected]>
Cc Martin K. Petersen <[email protected]>
Cc Ming Lei <[email protected]>
Cc Keith Busch <[email protected]>
Cc Damien Le Moal <[email protected]>
Cc Yu Kuai <[email protected]>
Cc Ed Tsai <[email protected]>
---
 drivers/ufs/core/ufshcd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/ufs/core/ufshcd.c +1 -0
index c2df07545f96..ed04d1263e02 100644
@@ -8866,6 +8866,7 @@ static const struct scsi_host_template ufshcd_driver_template = {
 	.max_host_blocked	= 1,
 	.track_queue_depth	= 1,
 	.skip_settle_delay	= 1,
+	.disable_fair_tag_sharing = 1,
 	.sdev_groups		= ufshcd_driver_groups,
 	.rpm_autosuspend_delay	= RPM_AUTOSUSPEND_DELAY_MS,
 };
reviewer Reviewed-by on v4 3/3
#4 lore raw

RE: [PATCH v4 3/3] scsi: ufs: Disable fair tag sharing

Quoted 5 lines

Disable the block layer fair tag sharing algorithm because it significantly reduces performance of UFS devices with a maximum queue depth of 32.

Quoted 8 lines
Cc Christoph Hellwig <[email protected]>
Cc Martin K. Petersen <[email protected]>
Cc Ming Lei <[email protected]>
Cc Keith Busch <[email protected]>
Cc Damien Le Moal <[email protected]>
Cc Yu Kuai <[email protected]>
Cc Ed Tsai <[email protected]>
Quoted 17 lines
---
 drivers/ufs/core/ufshcd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/ufs/core/ufshcd.c +1 -0
index c2df07545f96..ed04d1263e02 100644
@@ -8866,6 +8866,7 @@ static const struct scsi_host_template
 ufshcd_driver_template = {
        .max_host_blocked       = 1,
        .track_queue_depth      = 1,
        .skip_settle_delay      = 1,
+       .disable_fair_tag_sharing = 1,
        .sdev_groups            = ufshcd_driver_groups,
        .rpm_autosuspend_delay  = RPM_AUTOSUSPEND_DELAY_MS,

};

#5 lore raw
In reply to Bart Van Assche

Hi Bart,

Quoted 10 lines · Bart Van Assche

Hi Jens,

Performance of UFS devices is reduced significantly by the fair tag sharing algorithm. This is because UFS devices have multiple logical units and a limited queue depth (32 for UFS 3.1 devices) and also because it takes time to give tags back after activity on a request queue has stopped. This patch series addresses this issue by introducing a flag that allows block drivers to disable fair sharing.

Please consider this patch series for the next merge window.

In previous post[1], you mentioned that the issue is caused by non-IO queue of WLUN, but in this version, looks there isn't such story any more.

IMO, it isn't reasonable to account non-IO LUN for tag fairness, so solution could be to not take non-IO queue into account for fair tag sharing. But disabling fair tag sharing for this whole tagset could be too over-kill.

And if you mean normal IO LUNs, can you share more details about the performance drop? such as the test case, how many IO LUNs, and how to observe performance drop, cause it isn't simple any more since multiple LUN's perf has to be considered.

[1] https://lore.kernel.org/linux-block/[email protected]/

Thanks,
Ming

author reviewer
#6 lore raw
Quoted 18 lines · Ming Lei
Quoted 8 lines · Bart Van Assche

Performance of UFS devices is reduced significantly by the fair tag sharing algorithm. This is because UFS devices have multiple logical units and a limited queue depth (32 for UFS 3.1 devices) and also because it takes time to give tags back after activity on a request queue has stopped. This patch series addresses this issue by introducing a flag that allows block drivers to disable fair sharing.

Please consider this patch series for the next merge window.

In previous post[1], you mentioned that the issue is caused by non-IO queue of WLUN, but in this version, looks there isn't such story any more.

IMO, it isn't reasonable to account non-IO LUN for tag fairness, so solution could be to not take non-IO queue into account for fair tag sharing. But disabling fair tag sharing for this whole tagset could be too over-kill.

Quoted 6 lines

And if you mean normal IO LUNs, can you share more details about the performance drop? such as the test case, how many IO LUNs, and how to observe performance drop, cause it isn't simple any more since multiple LUN's perf has to be considered.

[1] https://lore.kernel.org/linux-block/[email protected]/

Hi Ming,

Submitting I/O to a WLUN is only one example of a use case that activates the fair sharing algorithm for UFS devices. Another use case is simultaneous activity for multiple data LUNs. Conventional UFS devices typically have four data LUNs and zoned UFS devices typically have five data LUNs. From an Android device with a zoned UFS device:

$ adb shell ls /sys/class/scsi_device
0:0:0:0
0:0:0:1
0:0:0:2
0:0:0:3
0:0:0:4
0:0:0:49456
0:0:0:49476
0:0:0:49488

The first five are data logical units. The last three are WLUNs.

For a block size of 4 KiB, I see 144 K IOPS for queue depth 31 and 107 K IOPS for queue depth 15 (queue depth is reduced from 31 to 15 if I/O is being submitted to two LUNs simultaneously). In other words, disabling fair sharing results in up to 35% higher IOPS for small reads and in case two logical units are active simultaneously. I think that's a very significant performance difference.

Thanks,

Bart.

#7 lore raw
Quoted 45 lines · Bart Van Assche
Quoted 18 lines · Ming Lei
Quoted 8 lines · Bart Van Assche

Performance of UFS devices is reduced significantly by the fair tag sharing algorithm. This is because UFS devices have multiple logical units and a limited queue depth (32 for UFS 3.1 devices) and also because it takes time to give tags back after activity on a request queue has stopped. This patch series addresses this issue by introducing a flag that allows block drivers to disable fair sharing.

Please consider this patch series for the next merge window.

In previous post[1], you mentioned that the issue is caused by non-IO queue of WLUN, but in this version, looks there isn't such story any more.

IMO, it isn't reasonable to account non-IO LUN for tag fairness, so solution could be to not take non-IO queue into account for fair tag sharing. But disabling fair tag sharing for this whole tagset could be too over-kill.

Quoted 6 lines

And if you mean normal IO LUNs, can you share more details about the performance drop? such as the test case, how many IO LUNs, and how to observe performance drop, cause it isn't simple any more since multiple LUN's perf has to be considered.

[1] https://lore.kernel.org/linux-block/[email protected]/

Hi Ming,

Submitting I/O to a WLUN is only one example of a use case that activates the fair sharing algorithm for UFS devices. Another use case is simultaneous activity for multiple data LUNs. Conventional UFS devices typically have four data LUNs and zoned UFS devices typically have five data LUNs. From an Android device with a zoned UFS device:

$ adb shell ls /sys/class/scsi_device
0:0:0:0
0:0:0:1
0:0:0:2
0:0:0:3
0:0:0:4
0:0:0:49456
0:0:0:49476
0:0:0:49488
Quoted 8 lines

The first five are data logical units. The last three are WLUNs.

For a block size of 4 KiB, I see 144 K IOPS for queue depth 31 and 107 K IOPS for queue depth 15 (queue depth is reduced from 31 to 15 if I/O is being submitted to two LUNs simultaneously). In other words, disabling fair sharing results in up to 35% higher IOPS for small reads and in case two logical units are active simultaneously. I think that's a very significant performance difference.

Yeah, performance does drop when queue depth is cut to half if queue depth is low enough.

However, it isn't enough to just test perf over one LUN, what is the perf effect when running IOs over the 2 or 5 data LUNs concurrently?

SATA should have similar issue too, and I think the improvement may be more generic to bypass fair tag sharing in case of low queue depth (such as < 32) if turns out the fair tag sharing doesn't work well in case low queue depth.

Also the 'fairness' could be enhanced dynamically by scsi LUN's queue depth, which can be adjusted dynamically.

Thanks,
Ming

reviewer
#8 lore raw

Hi,

Quoted 9 lines · Bart Van Assche
Quoted 8 lines · Ming Lei
Quoted 7 lines · Bart Van Assche
Quoted 6 lines

Performance of UFS devices is reduced significantly by the fair tag sharing algorithm. This is because UFS devices have multiple logical units and a limited queue depth (32 for UFS 3.1 devices) and also because it takes time to give tags back after activity on a request queue has stopped. This patch series addresses this issue by introducing a flag that allows block drivers to disable fair

Quoted 49 lines

sharing.

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

Please consider this patch series for the next merge window.

In previous post[1], you mentioned that the issue is caused by non-IO queue of WLUN, but in this version, looks there isn't such story

any more.

Quoted 42 lines
Quoted 6 lines

IMO, it isn't reasonable to account non-IO LUN for tag fairness, so solution could be to not take non-IO queue into account for fair tag sharing. But disabling fair tag sharing for this whole tagset could be too over-kill.

Quoted 8 lines

And if you mean normal IO LUNs, can you share more details about the performance drop? such as the test case, how many IO LUNs, and how to observe performance drop, cause it isn't simple any more since multiple LUN's perf has to be considered.

[1]
https://lore.kernel.org/linux-block/20231018180056.2151711-1-bvanass
[email protected]/

Hi Ming,

Submitting I/O to a WLUN is only one example of a use case that activates the fair sharing algorithm for UFS devices. Another use case is simultaneous activity for multiple data LUNs. Conventional UFS devices typically have four data LUNs and zoned UFS devices typically have five data LUNs. From an Android device with a zoned UFS device:

$ adb shell ls /sys/class/scsi_device
0:0:0:0
0:0:0:1
0:0:0:2
0:0:0:3
0:0:0:4
0:0:0:49456
0:0:0:49476
0:0:0:49488

The first five are data logical units. The last three are WLUNs.

For a block size of 4 KiB, I see 144 K IOPS for queue depth 31 and 107 K IOPS for queue depth 15 (queue depth is reduced from 31 to 15 if I/O is being submitted to two LUNs simultaneously). In other words, disabling fair sharing results in up to 35% higher IOPS for small reads and in case two logical units are active simultaneously. I think that's a very significant performance difference.

This issue is known for a long time now.
Whenever we needed to provide performance measures,
We used to disable that mechanism, hacking the kernel locally - one way or the other. I know that my peers are doing this as well.

Quoted 7 lines

Yeah, performance does drop when queue depth is cut to half if queue depth is low enough.

However, it isn't enough to just test perf over one LUN, what is the perf effect when running IOs over the 2 or 5 data LUNs concurrently?

Quoted 7 lines

SATA should have similar issue too, and I think the improvement may be more generic to bypass fair tag sharing in case of low queue depth (such as <
32) if turns out the fair tag sharing doesn't work well in case low queue depth.

Also the 'fairness' could be enhanced dynamically by scsi LUN's queue depth, which can be adjusted dynamically.

As far our concern as a ufs device manufacturers & users,
We find the current proposal a clean and elegant solution we like to adopt. Further, more sophisticated scheme can be adopted on top of disabling tag sharing.

Thanks,
Avri

Quoted 4 lines

Thanks,
Ming

author reviewer
#9 lore raw
Quoted 4 lines · Avri Altman

This issue is known for a long time now.
Whenever we needed to provide performance measures,
We used to disable that mechanism, hacking the kernel locally - one way or the other. I know that my peers are doing this as well.

The Android 14 kernels have this patch since May (five months ago). None of the OEMs who use this kernel branch have complained so far.

Thanks,

Bart.

author reviewer
#10 lore raw
In reply to Ming Lei
Quoted 6 lines · Ming Lei

Yeah, performance does drop when queue depth is cut to half if queue depth is low enough.

However, it isn't enough to just test perf over one LUN, what is the perf effect when running IOs over the 2 or 5 data LUNs concurrently?

I think that the results I shared are sufficient because these show the worst possible performance impact of fair tag sharing (two active logical units and much more activity on one logical unit than on the other).

Quoted 6 lines

SATA should have similar issue too, and I think the improvement may be more generic to bypass fair tag sharing in case of low queue depth (such as < 32) if turns out the fair tag sharing doesn't work well in
case low queue depth.

Also the 'fairness' could be enhanced dynamically by scsi LUN's queue depth, which can be adjusted dynamically.

Most SATA devices are hard disks. Hard disk IOPS are constrained by the speed with which the head of a hard disk can move. That speed hasn't changed much during the past 40 years. I'm not sure that hard disks are impacted as much as SSD devices by fair tag sharing.

Any algorithm that is more complicated than what I posted probably would have a negative performance impact on storage devices that use NAND technology, e.g. UFS devices. So I prefer to proceed with this patch series and solve any issues with ATA devices separately. Once this patch series has been merged, it could be used as a basis for a solution for ATA devices. A solution for ATA devices does not have to be implemented in the block layer core - it could e.g. be implemented in the ATA subsystem.

Thanks,

Bart.

#11 lore raw
Quoted 5 lines · Bart Van Assche
Quoted 3 lines · Ming Lei

Yeah, performance does drop when queue depth is cut to half if queue depth is low enough.

Quoted 8 lines
Quoted 3 lines

However, it isn't enough to just test perf over one LUN, what is the perf effect when running IOs over the 2 or 5 data LUNs concurrently?

I think that the results I shared are sufficient because these show the worst possible performance impact of fair tag sharing (two active logical units and much more activity on one logical unit than on the other).

You are talking about multi-lun case, and your change does affect multi-lun code path, but your test result doesn't cover multi-lun, is it enough?

At least your patch shouldn't cause performance regression on multi-lun IO workloads, right?

Quoted 6 lines
Quoted 6 lines

SATA should have similar issue too, and I think the improvement may be more generic to bypass fair tag sharing in case of low queue depth (such as < 32) if turns out the fair tag sharing doesn't work well in case low queue depth.

Quoted 7 lines
Quoted 2 lines

Also the 'fairness' could be enhanced dynamically by scsi LUN's queue depth, which can be adjusted dynamically.

Most SATA devices are hard disks. Hard disk IOPS are constrained by the speed with which the head of a hard disk can move. That speed hasn't changed much during the past 40 years. I'm not sure that hard disks are impacted as much as SSD devices by fair tag sharing.

What I meant is that SATA's queue depth is often 32 or 31, and still have multi-lun cases.

At least from what you shared, the fair tag sharing doesn't work well just because of low queue depth, nothing is actually related with UFS.

That is why I am wondering that why not force to disable fairing sharing in case of low queue depth.

Quoted 8 lines

Any algorithm that is more complicated than what I posted probably would have a negative performance impact on storage devices that use NAND technology, e.g. UFS devices. So I prefer to proceed with this patch series and solve any issues with ATA devices separately. Once this patch series has been merged, it could be used as a basis for a solution for ATA devices. A solution for ATA devices does not have to be implemented in the block layer core - it could e.g. be implemented in the ATA subsystem.

I don't object to take the disabling fair sharing first, and I meant that the fairness may be brought back by adjusting scsi_device's queue depth in future.

Thanks,
Ming

author reviewer
#12 lore raw
Quoted 2 lines · Ming Lei

You are talking about multi-lun case, and your change does affect multi-lun code path, but your test result doesn't cover multi-lun, is it enough?

I think that the results I shared are sufficient because these show the worst possible performance impact of fair tag sharing. If there are two active logical units and much more I/O is sent to one logical unit than to the other, then the aggregate performance will be very close to what I shared in a previous email.

Quoted 2 lines

At least your patch shouldn't cause performance regression on multi-lun IO workloads, right?

If blk_mq_get_tag() can't allocate a tag, and if multiple threads are waiting for a tag, the thread that called blk_mq_get_tag() first is granted the first tag that is released. I think this guarantees fairness if all requests have a similar latency. There will be some unfairness if there are significant differences in latency per logical unit, e.g. because all requests sent to one logical unit are small and because all requests sent to another logical unit are large. Whether or not this matters depends on the use case.

Thanks,

Bart.

#13 lore raw

Hi,

Quoted 8 lines · Bart Van Assche

If blk_mq_get_tag() can't allocate a tag, and if multiple threads are waiting for a tag, the thread that called blk_mq_get_tag() first is granted the first tag that is released. I think this guarantees fairness if all requests have a similar latency. There will be some unfairness if there are significant differences in latency per logical unit, e.g. because all requests sent to one logical unit are small and because all requests sent to another logical unit are large. Whether or not this matters depends on the use case.

I'm afraid that is not correct, fairness can't be guranteed at all, not even with just one scsi disk. This is because there are 8 wait queues in sbitmap, and threads are waiting in roundrobin mode, and each time wake_batch tags are released, wake_batch threads of one wait queue will be woke up, regardless that some threads can't grab tag after woken up, what's worse, thoese thread will be added to the tail of waitqueue again.

In the case that high io pressure under a slow disk, this behaviour will cause that io tail latency will be quite bad compared to sq from old kernel.

AFAIC, disable tag sharing will definitely case some regresion, for example, one disk will high io pressure, and another disk only issure one IO at a time, disable tag sharing can improve brandwith of fist disk, however, for the latter disk, IO latency will definitely be much worse.

Thanks,
Kuai

Quoted 9 lines

Thanks,

Bart.

.

author reviewer
#14 lore raw
Quoted 12 lines · Yu Kuai

I'm afraid that is not correct, fairness can't be guranteed at all, not even with just one scsi disk. This is because there are 8 wait queues in sbitmap, and threads are waiting in roundrobin mode, and each time wake_batch tags are released, wake_batch threads of one wait queue will be woke up, regardless that some threads can't grab tag after woken up, what's worse, thoese thread will be added to the tail of waitqueue again.

In the case that high io pressure under a slow disk, this behaviour will cause that io tail latency will be quite bad compared to sq from old kernel.

Quoted 5 lines

AFAIC, disable tag sharing will definitely case some regresion, for example, one disk will high io pressure, and another disk only issure one IO at a time, disable tag sharing can improve brandwith of fist disk, however, for the latter disk, IO latency will definitely be much worse.

Hi Yu,

All UFS users I know prefer that fair tag sharing is disabled for UFS devices. So I propose to proceed with this patch series and additionally to improve fair tag sharing for devices and transport layers that need an improved sharing algorithm.

Thanks,

Bart.