public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Uday Shankar <ushankar@purestorage.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org,
	Riley Thomasson <riley@purestorage.com>
Subject: Re: [PATCH] ublk: remove segment count and size limits
Date: Tue, 30 Apr 2024 17:15:18 +0800	[thread overview]
Message-ID: <ZjC2phkIYPeUdN2S@fedora> (raw)
In-Reply-To: <20240430005330.2786014-1-ushankar@purestorage.com>

On Mon, Apr 29, 2024 at 06:53:31PM -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.
> 
> Signed-off-by: Uday Shankar <ushankar@purestorage.com>
> Reviewed-by: Riley Thomasson <riley@purestorage.com>
> ---
>  drivers/block/ublk_drv.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
> index bea3d5cf8a83..835b0cc7c032 100644
> --- a/drivers/block/ublk_drv.c
> +++ b/drivers/block/ublk_drv.c
> @@ -2209,6 +2209,9 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub, struct io_uring_cmd *cmd)
>  		lim.max_zone_append_sectors = p->max_zone_append_sectors;
>  	}
>  
> +	lim.max_segments = USHRT_MAX;
> +	lim.max_segment_size = UINT_MAX;

Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thanks,
Ming


  reply	other threads:[~2024-04-30  9:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30  0:53 [PATCH] ublk: remove segment count and size limits Uday Shankar
2024-04-30  9:15 ` Ming Lei [this message]
2024-04-30 12:59 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZjC2phkIYPeUdN2S@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=riley@purestorage.com \
    --cc=ushankar@purestorage.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox