* [PATCH v2] ublk: remove segment count and size limits
@ 2024-04-30 21:16 Uday Shankar
2024-04-30 21:37 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Uday Shankar @ 2024-04-30 21:16 UTC (permalink / raw)
To: Ming Lei, Jens Axboe, Christoph Hellwig
Cc: linux-block, Uday Shankar, Riley Thomasson
ublk_drv currently creates block devices with the default max_segments
and max_segment_size limits of BLK_MAX_SEGMENTS (128) and
BLK_MAX_SEGMENT_SIZE (65536) respectively. These defaults can
artificially constrain the I/O size seen by the ublk server - for
example, suppose that the ublk server has configured itself to accept
I/Os up to 1M and the application is also issuing 1M sized I/Os. If the
I/O buffer used by the application is backed by 4K pages, the buffer
could consist of up to 1M / 4K = 256 physically discontiguous segments
(even if the buffer is virtually contiguous). As such, the I/O could
exceed the default max_segments limit and get split. This can cause
unnecessary performance issues if the ublk server is optimized to handle
1M I/Os. The block layer's segment count/size limits exist to model
hardware constraints which don't exist in ublk_drv's case, so just
remove those limits for the block devices created by ublk_drv.
Signed-off-by: Uday Shankar <ushankar@purestorage.com>
Reviewed-by: Riley Thomasson <riley@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
---
Changes since v1 (https://lore.kernel.org/linux-block/20240430005330.2786014-1-ushankar@purestorage.com/):
- Moved max_segments and max_segment_size into the designated
initializer
drivers/block/ublk_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index bea3d5cf8a83..374e4efa8759 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -2177,7 +2177,8 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub, struct io_uring_cmd *cmd)
.max_hw_sectors = p->max_sectors,
.chunk_sectors = p->chunk_sectors,
.virt_boundary_mask = p->virt_boundary_mask,
-
+ .max_segments = USHRT_MAX,
+ .max_segment_size = UINT_MAX,
};
struct gendisk *disk;
int ret = -EINVAL;
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] ublk: remove segment count and size limits
2024-04-30 21:16 [PATCH v2] ublk: remove segment count and size limits Uday Shankar
@ 2024-04-30 21:37 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2024-04-30 21:37 UTC (permalink / raw)
To: Ming Lei, Christoph Hellwig, Uday Shankar; +Cc: linux-block, Riley Thomasson
On Tue, 30 Apr 2024 15:16:24 -0600, Uday Shankar wrote:
> ublk_drv currently creates block devices with the default max_segments
> and max_segment_size limits of BLK_MAX_SEGMENTS (128) and
> BLK_MAX_SEGMENT_SIZE (65536) respectively. These defaults can
> artificially constrain the I/O size seen by the ublk server - for
> example, suppose that the ublk server has configured itself to accept
> I/Os up to 1M and the application is also issuing 1M sized I/Os. If the
> I/O buffer used by the application is backed by 4K pages, the buffer
> could consist of up to 1M / 4K = 256 physically discontiguous segments
> (even if the buffer is virtually contiguous). As such, the I/O could
> exceed the default max_segments limit and get split. This can cause
> unnecessary performance issues if the ublk server is optimized to handle
> 1M I/Os. The block layer's segment count/size limits exist to model
> hardware constraints which don't exist in ublk_drv's case, so just
> remove those limits for the block devices created by ublk_drv.
>
> [...]
Applied, thanks!
[1/1] ublk: remove segment count and size limits
commit: eaf4a9b19b9961f8ca294c39c5f8984a4cf42212
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-30 21:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-30 21:16 [PATCH v2] ublk: remove segment count and size limits Uday Shankar
2024-04-30 21:37 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox