Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp900773imj; Fri, 15 Feb 2019 08:37:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IZZdlLLOEYgxVzo5SQBWB1nDGPSxa/A10rgni2aDx40x+St3ks9t16M8bpe6QvaRu2/mg3i X-Received: by 2002:a63:b70b:: with SMTP id t11mr6126965pgf.404.1550248671166; Fri, 15 Feb 2019 08:37:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550248671; cv=none; d=google.com; s=arc-20160816; b=a/1Rku/puuCK/DQ8w/u2FNpKEPzbKVcEb68NXsGNd++aBv3uQiIubviljEXd7VtiAp FluGSgTrCuHX+E8gNktinVSE4oLhhK31pcClIvfAYLs5jHQHcFU4mC/VKwpr84LpsJ6h 59bNyPlK+Q7BZa0FCvvzFVrQXbo3Q6iUSMNRShEXem3qA0/gb9MPq3Rnz7GQZ4tOyaAN saljWnF9jvo4l9VOH7f/Ov9A3JkE8GVAKfyk3pjO1/nQiPgxWVLjoLWp0Dt+m5ENDgUP ZWgWXpGpoSzy69OE6aw1LnJXhc9qk14jlJymJ+V9Gw7VOWgu6vO+iaU7R2IPdKRF8QRI AaJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=gxvfq5TL/2HmGfmAumLfCM1Ftb4XqCEsXRfcSZF+1T0=; b=c9nhhuwdv1L8+9YhYCHM+CmMu1VZ0HqfMXsQ9o5+2UHq8RzrI3aY+EkrjxQuWjV3Ae pX/o8M9xal2Hf6LxwdNV5GRvo0LjDar5oC/J/5gFW92U/QsR4byTO60RYrtHZX+alin+ 3m+x/Zkq+XGrLwViFX0AwNZEM1306SDj+WKSk1OQ1oyPdXRT7dvtBbaG7+qdnhNIHDzS U7nw3m0laYG3+xHLoxIyFwMikdJMxF+Aa19hW/0Jt+g0Lt/a2tzYEaP/DFOLISg3F/p5 5FSviO+9ZpMONlNY9efkuou++BQMyaTHYiJY9ioHxO8FLvihAQJapqGRJatFLi7S3/gJ KVQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b="h9OUIip/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l186si4600998pge.482.2019.02.15.08.37.35; Fri, 15 Feb 2019 08:37:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b="h9OUIip/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388090AbfBOPth (ORCPT + 99 others); Fri, 15 Feb 2019 10:49:37 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:52508 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731311AbfBOPtf (ORCPT ); Fri, 15 Feb 2019 10:49:35 -0500 Received: by mail-it1-f193.google.com with SMTP id r11so25096755itc.2 for ; Fri, 15 Feb 2019 07:49:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=gxvfq5TL/2HmGfmAumLfCM1Ftb4XqCEsXRfcSZF+1T0=; b=h9OUIip/xw+IU3EFOgAuJ2mEtH+VQuLeB4N2O2e5L27iYvYrtP6ekFwJsYUVSR8Bs1 V392XnrQeNAUy7rzEK5X9RjrKX8vmLHjqRiG5HONgjRm2+fOgE6f7wJuvX6QtuzsWOdF MfkNy1spvU8KVAOhzx2gB7lsHkND6yni833wB9wMTVzynMNMNsVhVjpfEHZ2/3qGsz9D rXvPlMf1e6MpwVMTBVf+gHJWXTWyumwVlENzGzRya5qqopY95rsZqVKBmvI+tskX1FeI khsRD7p9S2INbR0YIRanHv6C+VCXUUdEVjlIFSQ4S3sSSa7xj2Un1EU661Qgk61bbUHy K1+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=gxvfq5TL/2HmGfmAumLfCM1Ftb4XqCEsXRfcSZF+1T0=; b=QxzKSlKjav3aRy+zdidNerbJM2jYSW7boXS/jpFVqSLrCe0skc8QlmzCFXdu89kTL0 G5L+v/xqccrd3Y4Dp+iQTzIA7R4ox8gKEc3TvrUaJVqns+ekT8QEaPb6ibR3qNToF7lr jzjvsLAe27lIM5uTftlSHW0VQjAjV7HMFFRiFWMYAHiWJdCr9Afakocnzi4qCUr+9UwO qMQh5VTfhFGxeSOzHmPh2X6GV0d4ygjdB4ASpVnkMZJ42xMxRFAKIdElMmvrFA3HnM/+ 2GFwt2r4/30rBrteCVPvaQsuqQDykcohso909NLMdbQSyENVqcWxht+9YUYqpggicSZa MX8g== X-Gm-Message-State: AHQUAuYflC50dwTIi63v1RwOUeYW/e+47NAdktBkzyC6kU0gZj4XSq67 ImUysi8N5RW3NlNTni9TiRbcrg== X-Received: by 2002:a02:984d:: with SMTP id x13mr4966711jaj.140.1550245774598; Fri, 15 Feb 2019 07:49:34 -0800 (PST) Received: from [192.168.1.158] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id w186sm2639569itb.15.2019.02.15.07.49.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Feb 2019 07:49:33 -0800 (PST) Subject: Re: [PATCH V15 00/18] block: support multi-page bvec To: Ming Lei Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Theodore Ts'o , Omar Sandoval , Sagi Grimberg , Dave Chinner , Kent Overstreet , Mike Snitzer , dm-devel@redhat.com, Alexander Viro , linux-fsdevel@vger.kernel.org, linux-raid@vger.kernel.org, David Sterba , linux-btrfs@vger.kernel.org, "Darrick J . Wong" , linux-xfs@vger.kernel.org, Gao Xiang , Christoph Hellwig , linux-ext4@vger.kernel.org, Coly Li , linux-bcache@vger.kernel.org, Boaz Harrosh , Bob Peterson , cluster-devel@redhat.com References: <20190215111324.30129-1-ming.lei@redhat.com> From: Jens Axboe Message-ID: Date: Fri, 15 Feb 2019 08:49:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190215111324.30129-1-ming.lei@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/15/19 4:13 AM, Ming Lei wrote: > Hi, > > This patchset brings multi-page bvec into block layer: > > 1) what is multi-page 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 multi-page bvec introduced? > > Kent proposed the idea[1] first. > > As system's RAM becomes much bigger than before, and 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. > As we saw, if CONFIG_THP_SWAP is enabled, BIO_MAX_PAGES can be configured > as much bigger, such as 512, which requires at least two 4K pages for holding > the bvec table. > > With multi-page bvec: > > - 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. > > - 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]. > > - there is opportunity in future to improve memory footprint of bvecs. > > 3) how is multi-page bvec implemented in this patchset? > > Patch 1 ~ 3 parpares for supporting multi-page bvec. > > Patches 4 ~ 14 implement 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 > > - introduce bio_for_each_bvec() to iterate over multipage bvec for splitting > bio and mapping sg > > - keep current bio_for_each_segment*() to itereate over singlepage bvec and > make sure current users won't be broken; especailly, convert to this > new helper prototype in single patch 21 given it is bascially a mechanism > conversion > > - deal with iomap & xfs's sub-pagesize io vec in patch 13 > > - enalbe multipage bvec in patch 14 > > Patch 15 redefines BIO_MAX_PAGES as 256. > > Patch 16 documents usages of bio iterator helpers. > > Patch 17~18 kills NO_SG_MERGE. > > These patches can be found in the following git tree: > > git: https://github.com/ming1/linux.git v5.0-blk_mp_bvec_v14 ^^^ v15? > Lots of test(blktest, xfstests, ltp io, ...) have been run with this patchset, > and not see regression. > > Thanks Christoph for reviewing 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. > > Thanks Chritoph and Omar for reviewing V10/V11/V12, and provides lots of > helpful comments. Applied, thanks Ming. Let's hope it sticks! -- Jens Axboe