public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] scsi: target: Fix write perf due to unneeded throttling
@ 2023-08-17 19:29 Mike Christie
  2023-08-21 21:21 ` Martin K. Petersen
  2023-08-25  1:12 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Christie @ 2023-08-17 19:29 UTC (permalink / raw)
  To: martin.petersen, linux-scsi, target-devel; +Cc: Mike Christie

The write back throttling (WBT) code checks if REQ_SYNC | REQ_IDLE is set
to determine if a write is O_DIRECT vs buffered. If the bits are not set
then it assumes it's a buffered write and will throttle LIO if we hit
certain metrics. LIO itself is not using the buffer cache and is doing
direct IO, so this has us set the direct bits so we are not throttled.

When the initiator application is doing direct IO this can greatly
improve performance. It depends on the backend device but we have seen
where the WBT code is throttling writes to only 20K IOPs with 4K IOs when
the device can support 100K+.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/target/target_core_iblock.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 3d1b511ea284..5937a7ed6989 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -740,11 +740,16 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 
 	if (data_direction == DMA_TO_DEVICE) {
 		struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
+
+		/*
+		 * Set bits to indicate WRITE_ODIRECT so we are not throttled
+		 * by WBT.
+		 */
+		opf = REQ_OP_WRITE | REQ_SYNC | REQ_IDLE;
 		/*
 		 * Force writethrough using REQ_FUA if a volatile write cache
 		 * is not enabled, or if initiator set the Force Unit Access bit.
 		 */
-		opf = REQ_OP_WRITE;
 		miter_dir = SG_MITER_TO_SG;
 		if (bdev_fua(ib_dev->ibd_bd)) {
 			if (cmd->se_cmd_flags & SCF_FUA)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] scsi: target: Fix write perf due to unneeded throttling
  2023-08-17 19:29 [PATCH 1/1] scsi: target: Fix write perf due to unneeded throttling Mike Christie
@ 2023-08-21 21:21 ` Martin K. Petersen
  2023-08-25  1:12 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2023-08-21 21:21 UTC (permalink / raw)
  To: Mike Christie; +Cc: martin.petersen, linux-scsi, target-devel


Mike,

> The write back throttling (WBT) code checks if REQ_SYNC | REQ_IDLE is
> set to determine if a write is O_DIRECT vs buffered. If the bits are
> not set then it assumes it's a buffered write and will throttle LIO if
> we hit certain metrics. LIO itself is not using the buffer cache and
> is doing direct IO, so this has us set the direct bits so we are not
> throttled.
>
> When the initiator application is doing direct IO this can greatly
> improve performance. It depends on the backend device but we have seen
> where the WBT code is throttling writes to only 20K IOPs with 4K IOs
> when the device can support 100K+.

Applied to 6.6/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] scsi: target: Fix write perf due to unneeded throttling
  2023-08-17 19:29 [PATCH 1/1] scsi: target: Fix write perf due to unneeded throttling Mike Christie
  2023-08-21 21:21 ` Martin K. Petersen
@ 2023-08-25  1:12 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2023-08-25  1:12 UTC (permalink / raw)
  To: linux-scsi, target-devel, Mike Christie; +Cc: Martin K . Petersen

On Thu, 17 Aug 2023 14:29:02 -0500, Mike Christie wrote:

> The write back throttling (WBT) code checks if REQ_SYNC | REQ_IDLE is set
> to determine if a write is O_DIRECT vs buffered. If the bits are not set
> then it assumes it's a buffered write and will throttle LIO if we hit
> certain metrics. LIO itself is not using the buffer cache and is doing
> direct IO, so this has us set the direct bits so we are not throttled.
> 
> When the initiator application is doing direct IO this can greatly
> improve performance. It depends on the backend device but we have seen
> where the WBT code is throttling writes to only 20K IOPs with 4K IOs when
> the device can support 100K+.
> 
> [...]

Applied to 6.6/scsi-queue, thanks!

[1/1] scsi: target: Fix write perf due to unneeded throttling
      https://git.kernel.org/mkp/scsi/c/84c073fd89de

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-25  1:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-17 19:29 [PATCH 1/1] scsi: target: Fix write perf due to unneeded throttling Mike Christie
2023-08-21 21:21 ` Martin K. Petersen
2023-08-25  1:12 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox