All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/49] block: support multipage bvec
@ 2017-08-08  8:44 ` Ming Lei
  0 siblings, 0 replies; 160+ messages in thread
From: Ming Lei @ 2017-08-08  8:44 UTC (permalink / raw)
  To: Jens Axboe, Christoph Hellwig, Huang Ying, Andrew Morton, Alexander Viro
  Cc: linux-kernel, linux-block, linux-fsdevel, linux-mm, Ming Lei

Hi,

This patchset brings multipage bvec into block layer:

1) what is multipage bvec?

Multipage bvecs means that one 'struct bio_bvec' can hold
multiple pages which are physically contiguous instead
of one single page used in linux kernel for long time.

2) why is multipage bvec introduced?

Kent proposed the idea[1] first. 

As system's RAM becomes much bigger than before, and 
at the same time huge page, transparent huge page and
memory compaction are widely used, it is a bit easy now
to see physically contiguous pages from fs in I/O.
On the other hand, from block layer's view, it isn't
necessary to store intermediate pages into bvec, and
it is enough to just store the physicallly contiguous
'segment' in each io vector.

Also huge pages are being brought to filesystem and swap
[2][6], we can do IO on a hugepage each time[3], which
requires that one bio can transfer at least one huge page
one time. Turns out it isn't flexiable to change BIO_MAX_PAGES
simply[3][5]. Multipage bvec can fit in this case very well.

With multipage bvec:

- segment handling in block layer can be improved much
in future since it should be quite easy to convert
multipage bvec into segment easily. For example, we might 
just store segment in each bvec directly in future.

- bio size can be increased and it should improve some
high-bandwidth IO case in theory[4].

- Inside block layer, both bio splitting and sg map can
become more efficient than before by just traversing the
physically contiguous 'segment' instead of each page.

- there is opportunity in future to improve memory footprint
of bvecs. 

3) how is multipage bvec implemented in this patchset?

The 1st 17 patches comment on some special cases and deal with
some special cases of direct access to bvec table.

The 2nd part(18~29) implements multipage bvec in block layer:

	- put all tricks into bvec/bio/rq iterators, and as far as
	drivers and fs use these standard iterators, they are happy
	with multipage bvec

	- use multipage bvec to split bio and map sg

	- bio_for_each_segment_all() changes
	this helper pass pointer of each bvec directly to user, and
	it has to be changed. Two new helpers(bio_for_each_segment_all_sp()
	and bio_for_each_segment_all_mp()) are introduced. 

The 3rd part(32~47) convert current users of bio_for_each_segment_all()
to bio_for_each_segment_all_sp()/bio_for_each_segment_all_mp().

The last part(48~49) enables multipage bvec.

These patches can be found in the following git tree:

	https://github.com/ming1/linux/commits/v4.13-rc3-block-next-mp-bvec-V3

Thanks Christoph for looking at the early version and providing
very good suggestions, such as: introduce bio_init_with_vec_table(),
remove another unnecessary helpers for cleanup and so on.

Any comments are welcome!

BTW, I will be on a trip in the following week, so may not reply
in time.

V3:
	- rebase on v4.13-rc3 with for-next of block tree
	- run more xfstests: xfs/ext4 over NVMe, Sata, DM(linear),
	MD(raid1), and not see regressions triggered
	- add Reviewed-by on some btrfs patches
	- remove two MD patches because both are merged to linus tree
	  already

V2:
	- bvec table direct access in raid has been cleaned, so NO_MP
	flag is dropped
	- rebase on recent Neil Brown's change on bio and bounce code
	- reorganize the patchset

V1:
	- against v4.10-rc1 and some cleanup in V0 are in -linus already
	- handle queue_virt_boundary() in mp bvec change and make NVMe happy
	- further BTRFS cleanup
	- remove QUEUE_FLAG_SPLIT_MP
	- rename for two new helpers of bio_for_each_segment_all()
	- fix bounce convertion
	- address comments in V0

[1], http://marc.info/?l=linux-kernel&m=141680246629547&w=2
[2], https://patchwork.kernel.org/patch/9451523/
[3], http://marc.info/?t=147735447100001&r=1&w=2
[4], http://marc.info/?l=linux-mm&m=147745525801433&w=2
[5], http://marc.info/?t=149569484500007&r=1&w=2
[6], http://marc.info/?t=149820215300004&r=1&w=2

Ming Lei (49):
  block: drbd: comment on direct access bvec table
  block: loop: comment on direct access to bvec table
  kernel/power/swap.c: comment on direct access to bvec table
  mm: page_io.c: comment on direct access to bvec table
  fs/buffer: comment on direct access to bvec table
  f2fs: f2fs_read_end_io: comment on direct access to bvec table
  bcache: comment on direct access to bvec table
  block: comment on bio_alloc_pages()
  block: comment on bio_iov_iter_get_pages()
  dm: limit the max bio size as BIO_MAX_PAGES * PAGE_SIZE
  btrfs: avoid access to .bi_vcnt directly
  btrfs: avoid to access bvec table directly for a cloned bio
  btrfs: comment on direct access bvec table
  block: bounce: avoid direct access to bvec table
  bvec_iter: introduce BVEC_ITER_ALL_INIT
  block: bounce: don't access bio->bi_io_vec in copy_to_high_bio_irq
  block: comments on bio_for_each_segment[_all]
  block: introduce multipage/single page bvec helpers
  block: implement sp version of bvec iterator helpers
  block: introduce bio_for_each_segment_mp()
  blk-merge: compute bio->bi_seg_front_size efficiently
  block: blk-merge: try to make front segments in full size
  block: blk-merge: remove unnecessary check
  block: use bio_for_each_segment_mp() to compute segments count
  block: use bio_for_each_segment_mp() to map sg
  block: introduce bvec_for_each_sp_bvec()
  block: bio: introduce single/multi page version of
    bio_for_each_segment_all()
  block: introduce bvec_get_last_page()
  fs/buffer.c: use bvec iterator to truncate the bio
  btrfs: use bvec_get_last_page to get bio's last page
  block: deal with dirtying pages for multipage bvec
  block: convert to singe/multi page version of
    bio_for_each_segment_all()
  bcache: convert to bio_for_each_segment_all_sp()
  md: raid1: convert to bio_for_each_segment_all_sp()
  dm-crypt: don't clear bvec->bv_page in crypt_free_buffer_pages()
  dm-crypt: convert to bio_for_each_segment_all_sp()
  fs/mpage: convert to bio_for_each_segment_all_sp()
  fs/block: convert to bio_for_each_segment_all_sp()
  fs/iomap: convert to bio_for_each_segment_all_sp()
  ext4: convert to bio_for_each_segment_all_sp()
  xfs: convert to bio_for_each_segment_all_sp()
  gfs2: convert to bio_for_each_segment_all_sp()
  f2fs: convert to bio_for_each_segment_all_sp()
  exofs: convert to bio_for_each_segment_all_sp()
  fs: crypto: convert to bio_for_each_segment_all_sp()
  fs/btrfs: convert to bio_for_each_segment_all_sp()
  fs/direct-io: convert to bio_for_each_segment_all_sp()
  block: enable multipage bvecs
  block: bio: pass segments to bio if bio_add_page() is bypassed

 block/bio.c                      | 137 ++++++++++++++++++++----
 block/blk-merge.c                | 226 +++++++++++++++++++++++++++++++--------
 block/blk-zoned.c                |   5 +-
 block/bounce.c                   |  39 ++++---
 drivers/block/drbd/drbd_bitmap.c |   1 +
 drivers/block/loop.c             |   5 +
 drivers/md/bcache/btree.c        |   4 +-
 drivers/md/bcache/super.c        |   6 ++
 drivers/md/bcache/util.c         |   7 ++
 drivers/md/dm-crypt.c            |   4 +-
 drivers/md/dm.c                  |  11 +-
 drivers/md/raid1.c               |   3 +-
 fs/block_dev.c                   |   6 +-
 fs/btrfs/compression.c           |  12 ++-
 fs/btrfs/disk-io.c               |   3 +-
 fs/btrfs/extent_io.c             |  38 +++++--
 fs/btrfs/extent_io.h             |   2 +-
 fs/btrfs/inode.c                 |  22 +++-
 fs/btrfs/raid56.c                |   1 +
 fs/buffer.c                      |  11 +-
 fs/crypto/bio.c                  |   3 +-
 fs/direct-io.c                   |   4 +-
 fs/exofs/ore.c                   |   3 +-
 fs/exofs/ore_raid.c              |   3 +-
 fs/ext4/page-io.c                |   3 +-
 fs/ext4/readpage.c               |   3 +-
 fs/f2fs/data.c                   |  13 ++-
 fs/gfs2/lops.c                   |   3 +-
 fs/gfs2/meta_io.c                |   3 +-
 fs/iomap.c                       |   3 +-
 fs/mpage.c                       |   3 +-
 fs/xfs/xfs_aops.c                |   3 +-
 include/linux/bio.h              |  67 +++++++++++-
 include/linux/blk_types.h        |   6 ++
 include/linux/bvec.h             | 141 ++++++++++++++++++++++--
 kernel/power/swap.c              |   2 +
 mm/page_io.c                     |   2 +
 37 files changed, 674 insertions(+), 134 deletions(-)

-- 
2.9.4

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

end of thread, other threads:[~2017-10-19 23:58 UTC | newest]

Thread overview: 160+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-08  8:44 [PATCH v3 00/49] block: support multipage bvec Ming Lei
2017-08-08  8:44 ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 01/49] block: drbd: comment on direct access bvec table Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-10 11:12   ` Christoph Hellwig
2017-08-10 11:12     ` Christoph Hellwig
2017-08-08  8:45 ` [PATCH v3 02/49] block: loop: comment on direct access to " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 03/49] kernel/power/swap.c: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 04/49] mm: page_io.c: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-10 11:14   ` Christoph Hellwig
2017-08-10 11:14     ` Christoph Hellwig
2017-08-08  8:45 ` [PATCH v3 05/49] fs/buffer: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-10 11:16   ` Christoph Hellwig
2017-08-10 11:16     ` Christoph Hellwig
2017-08-08  8:45 ` [PATCH v3 06/49] f2fs: f2fs_read_end_io: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 07/49] bcache: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08 12:36   ` Coly Li
2017-08-08 12:36     ` Coly Li
2017-08-08 12:36     ` Coly Li
2017-08-10 11:26   ` Christoph Hellwig
2017-08-10 11:26     ` Christoph Hellwig
2017-10-19 22:51     ` Ming Lei
2017-10-19 22:51       ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 08/49] block: comment on bio_alloc_pages() Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 09/49] block: comment on bio_iov_iter_get_pages() Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-10 11:28   ` Christoph Hellwig
2017-08-10 11:28     ` Christoph Hellwig
2017-10-19 22:55     ` Ming Lei
2017-10-19 22:55       ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 10/49] dm: limit the max bio size as BIO_MAX_PAGES * PAGE_SIZE Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-10 11:29   ` Christoph Hellwig
2017-08-10 11:29     ` Christoph Hellwig
2017-08-08  8:45 ` [PATCH v3 11/49] btrfs: avoid access to .bi_vcnt directly Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-10 11:29   ` Christoph Hellwig
2017-08-10 11:29     ` Christoph Hellwig
2017-10-19 22:57     ` Ming Lei
2017-10-19 22:57       ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 12/49] btrfs: avoid to access bvec table directly for a cloned bio Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 13/49] btrfs: comment on direct access bvec table Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 14/49] block: bounce: avoid direct access to " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 15/49] bvec_iter: introduce BVEC_ITER_ALL_INIT Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 16/49] block: bounce: don't access bio->bi_io_vec in copy_to_high_bio_irq Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 17/49] block: comments on bio_for_each_segment[_all] Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-10 11:32   ` Christoph Hellwig
2017-08-10 11:32     ` Christoph Hellwig
2017-08-08  8:45 ` [PATCH v3 18/49] block: introduce multipage/single page bvec helpers Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-10 12:00   ` Christoph Hellwig
2017-08-10 12:00     ` Christoph Hellwig
2017-08-08  8:45 ` [PATCH v3 19/49] block: implement sp version of bvec iterator helpers Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-10 12:01   ` Christoph Hellwig
2017-08-10 12:01     ` Christoph Hellwig
2017-08-08  8:45 ` [PATCH v3 20/49] block: introduce bio_for_each_segment_mp() Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-10 12:11   ` Christoph Hellwig
2017-08-10 12:11     ` Christoph Hellwig
2017-10-19 23:37     ` Ming Lei
2017-10-19 23:37       ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 21/49] blk-merge: compute bio->bi_seg_front_size efficiently Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-10 12:11   ` Christoph Hellwig
2017-08-10 12:11     ` Christoph Hellwig
2017-08-08  8:45 ` [PATCH v3 22/49] block: blk-merge: try to make front segments in full size Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-10 12:12   ` Christoph Hellwig
2017-08-10 12:12     ` Christoph Hellwig
2017-08-08  8:45 ` [PATCH v3 23/49] block: blk-merge: remove unnecessary check Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-10 12:12   ` Christoph Hellwig
2017-08-10 12:12     ` Christoph Hellwig
2017-08-08  8:45 ` [PATCH v3 24/49] block: use bio_for_each_segment_mp() to compute segments count Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 25/49] block: use bio_for_each_segment_mp() to map sg Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 26/49] block: introduce bvec_for_each_sp_bvec() Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 27/49] block: bio: introduce single/multi page version of bio_for_each_segment_all() Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 28/49] block: introduce bvec_get_last_page() Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 29/49] fs/buffer.c: use bvec iterator to truncate the bio Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 30/49] btrfs: use bvec_get_last_page to get bio's last page Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 31/49] block: deal with dirtying pages for multipage bvec Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 32/49] block: convert to singe/multi page version of bio_for_each_segment_all() Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 33/49] bcache: convert to bio_for_each_segment_all_sp() Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08 12:35   ` Coly Li
2017-08-08 12:35     ` Coly Li
2017-08-08 12:35     ` Coly Li
2017-08-08  8:45 ` [PATCH v3 34/49] md: raid1: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 35/49] dm-crypt: don't clear bvec->bv_page in crypt_free_buffer_pages() Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 36/49] dm-crypt: convert to bio_for_each_segment_all_sp() Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 37/49] fs/mpage: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-10 12:16   ` Christoph Hellwig
2017-08-10 12:16     ` Christoph Hellwig
2017-10-19 23:58     ` Ming Lei
2017-10-19 23:58       ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 38/49] fs/block: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 39/49] fs/iomap: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 40/49] ext4: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 41/49] xfs: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08 16:32   ` Darrick J. Wong
2017-08-08 16:32     ` Darrick J. Wong
2017-10-19 23:52     ` Ming Lei
2017-10-19 23:52       ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 42/49] gfs2: " Ming Lei
2017-08-08  8:45   ` [Cluster-devel] " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 43/49] f2fs: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 44/49] exofs: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 45/49] fs: crypto: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 46/49] fs/btrfs: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  9:00   ` Filipe Manana
2017-08-08  9:00     ` Filipe Manana
2017-08-08  9:00     ` Filipe Manana
2017-08-11 16:54   ` kbuild test robot
2017-08-11 16:54     ` kbuild test robot
2017-08-08  8:45 ` [PATCH v3 47/49] fs/direct-io: " Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-08  8:45 ` [PATCH v3 48/49] block: enable multipage bvecs Ming Lei
2017-08-08  8:45   ` Ming Lei
2017-08-18  1:24   ` [lkp-robot] [block] 434f2ea20d: fileio.requests_per_sec -3.1% regression kernel test robot
2017-08-18  1:24     ` kernel test robot
2017-08-18  1:24     ` kernel test robot
2017-08-18  1:24     ` kernel test robot
2017-08-08  8:45 ` [PATCH v3 49/49] block: bio: pass segments to bio if bio_add_page() is bypassed Ming Lei
2017-08-08  8:45   ` Ming Lei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.