mbox series

[v12,0/3] bio: control bio max size

Message ID 20210604050324.28670-1-nanich.lee@samsung.com (mailing list archive)
Headers show
Series bio: control bio max size | expand

Message

Changheun Lee June 4, 2021, 5:03 a.m. UTC
bio size can grow up to 4GB after muli-page bvec has been enabled.
But sometimes large size of bio would lead to inefficient behaviors.
Control of bio max size will be helpful to improve inefficiency.

blk_queue_max_bio_bytes() is added to enable be set the max_bio_bytes in
each driver layer. And max_bio_bytes sysfs is added to show current
max_bio_bytes for each request queue.
bio size can be controlled via max_bio_bytes.

Changheun Lee (3):
  bio: control bio max size
  blk-sysfs: add max_bio_bytes
  ufs: set max_bio_bytes with queue max sectors

 Documentation/ABI/testing/sysfs-block | 10 ++++++++++
 Documentation/block/queue-sysfs.rst   |  7 +++++++
 block/bio.c                           | 17 ++++++++++++++---
 block/blk-settings.c                  | 19 +++++++++++++++++++
 block/blk-sysfs.c                     |  7 +++++++
 drivers/scsi/ufs/ufshcd.c             |  5 +++++
 include/linux/bio.h                   |  4 +++-
 include/linux/blkdev.h                |  3 +++
 8 files changed, 68 insertions(+), 4 deletions(-)

Comments

Can Guo June 4, 2021, 6:41 a.m. UTC | #1
On 2021-06-04 13:03, Changheun Lee wrote:
> bio size can grow up to 4GB after muli-page bvec has been enabled.
> But sometimes large size of bio would lead to inefficient behaviors.
> Control of bio max size will be helpful to improve inefficiency.
> 
> blk_queue_max_bio_bytes() is added to enable be set the max_bio_bytes 
> in
> each driver layer. And max_bio_bytes sysfs is added to show current
> max_bio_bytes for each request queue.
> bio size can be controlled via max_bio_bytes.
> 

This is interesting, and we also noticed it right after multi-page bvec
is enabled since last year. Internally, we had a hack to disable it.
But it is good to have a tunable to control it. Thanks for the change.

Reviewed-by: Can Guo <cang@codeaurora.org>

> Changheun Lee (3):
>   bio: control bio max size
>   blk-sysfs: add max_bio_bytes
>   ufs: set max_bio_bytes with queue max sectors
> 
>  Documentation/ABI/testing/sysfs-block | 10 ++++++++++
>  Documentation/block/queue-sysfs.rst   |  7 +++++++
>  block/bio.c                           | 17 ++++++++++++++---
>  block/blk-settings.c                  | 19 +++++++++++++++++++
>  block/blk-sysfs.c                     |  7 +++++++
>  drivers/scsi/ufs/ufshcd.c             |  5 +++++
>  include/linux/bio.h                   |  4 +++-
>  include/linux/blkdev.h                |  3 +++
>  8 files changed, 68 insertions(+), 4 deletions(-)
Bart Van Assche June 4, 2021, 4:13 p.m. UTC | #2
On 6/3/21 10:03 PM, Changheun Lee wrote:
> bio size can grow up to 4GB after muli-page bvec has been enabled.
> But sometimes large size of bio would lead to inefficient behaviors.
> Control of bio max size will be helpful to improve inefficiency.
> 
> blk_queue_max_bio_bytes() is added to enable be set the max_bio_bytes in
> each driver layer. And max_bio_bytes sysfs is added to show current
> max_bio_bytes for each request queue.
> bio size can be controlled via max_bio_bytes.

Where is the version history for this patch series?

Has this patch series been tested in combination with dm-crypt?

Bart.
Changheun Lee June 7, 2021, 9:57 a.m. UTC | #3
> On 6/3/21 10:03 PM, Changheun Lee wrote:
> > bio size can grow up to 4GB after muli-page bvec has been enabled.
> > But sometimes large size of bio would lead to inefficient behaviors.
> > Control of bio max size will be helpful to improve inefficiency.
> > 
> > blk_queue_max_bio_bytes() is added to enable be set the max_bio_bytes in
> > each driver layer. And max_bio_bytes sysfs is added to show current
> > max_bio_bytes for each request queue.
> > bio size can be controlled via max_bio_bytes.
> 
> Where is the version history for this patch series?

Sorry. I didn't know about it. I'll do next. Thank you for advise.

> 
> Has this patch series been tested in combination with dm-crypt?

This patch has been tested in android device. And dm-crypt on the top of scsi
has tested with below scsi modification in VM too.

@@ -1837,6 +1837,8 @@  void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
	blk_queue_virt_boundary(q, shost->virt_boundary_mask);
	dma_set_max_seg_size(dev, queue_max_segment_size(q));
			 
+	blk_queue_max_bio_bytes(q, queue_max_sectors(q) << SECTOR_SHIFT);
+
	/*
	 * Set a reasonable default alignment:  The larger of 32-byte (dword),
	 * which is a common minimum for HBAs, and the minimum DMA alignment,

> 
> Bart.
> 

Thank you,
Changheun Lee