linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/51] block: support multipage bvec
@ 2017-06-26 12:09 Ming Lei
  2017-06-26 12:09 ` [PATCH v2 01/51] block: drbd: comment on direct access bvec table Ming Lei
                   ` (52 more replies)
  0 siblings, 53 replies; 61+ messages in thread
From: Ming Lei @ 2017-06-26 12:09 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 18 patches comment on some special cases and deal with
some special cases of direct access to bvec table.

The 2nd part(19~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(30~49) 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(50~51) enables multipage bvec.

These patches can be found in the following git tree:

	https://github.com/ming1/linux/commits/mp-bvec-1.4-v4.12-rc

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!

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 (51):
  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
  md: raid1: initialize bvec table via bio_add_page()
  md: raid10: avoid to access bvec table directly
  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                   |  35 +++---
 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               |  30 +++---
 drivers/md/raid10.c              |  22 +++-
 fs/block_dev.c                   |   6 +-
 fs/btrfs/compression.c           |  12 ++-
 fs/btrfs/disk-io.c               |   3 +-
 fs/btrfs/extent_io.c             |  39 +++++--
 fs/btrfs/extent_io.h             |   2 +-
 fs/btrfs/inode.c                 |  22 +++-
 fs/btrfs/raid56.c                |   6 +-
 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              |  72 +++++++++++--
 include/linux/blk_types.h        |   6 ++
 include/linux/bvec.h             | 142 ++++++++++++++++++++++--
 kernel/power/swap.c              |   2 +
 mm/page_io.c                     |   2 +
 38 files changed, 714 insertions(+), 151 deletions(-)

-- 
2.9.4

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

end of thread, other threads:[~2017-06-29 19:00 UTC | newest]

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).