From: Coly Li <colyli@suse.de>
To: Avi Kivity <avi@scylladb.com>, NeilBrown <neilb@suse.com>
Cc: linux-raid@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: raid0 vs. mkfs
Date: Wed, 7 Dec 2016 20:03:11 +0800 [thread overview]
Message-ID: <d1bc8201-7b4e-e85a-c1dc-b00c325ec23e@suse.de> (raw)
In-Reply-To: <ccf447df-e7b5-0a08-7753-67ee4ad574ef@suse.de>
On 2016/12/7 下午7:50, Coly Li wrote:
> On 2016/11/30 上午6:45, Avi Kivity wrote:
>> On 11/29/2016 11:14 PM, NeilBrown wrote:
> [snip]
>
>>>> So I disagree that all the work should be pushed to the merging layer.
>>>> It has less information to work with, so the fewer decisions it has to
>>>> make, the better.
>>> I think that the merging layer should be as efficient as it reasonably
>>> can be, and particularly should take into account plugging. This
>>> benefits all callers.
>>
>> Yes, but plugging does not mean "please merge anything you can until the
>> unplug".
>>
>>> If it can be demonstrated that changes to some of the upper layers bring
>>> further improvements with acceptable costs, then certainly it is good to
>>> have those too.
>>
>> Generating millions of requests only to merge them again is
>> inefficient. It happens in an edge case (TRIM of the entirety of a very
>> large RAID), but it already caused on user to believe the system
>> failed. I think the system should be more robust than that.
>
> Neil,
>
> As my understand, if a large discard bio received by
> raid0_make_request(), for example it requests to discard chunk 1 to 24
> on a raid0 device built by 4 SSDs. This large discard bio will be split
> and written to each SSD as the following layout,
>
> SSD1: C1,C5,C9,C13,C17,C21
> SSD2: C2,C6,C10,C14,C18,C22
> SSD3: C3,C7,C11,C15,C19,C23
> SSD4: C4,C8,C12,C16,C20,C24
>
> Current raid0 code will call generic_make_request() for 24 times for
> each split bio. But it is possible to calculate the final layout of each
> split bio, so we can combine all the bios into four per-SSD large bio,
> like this,
>
> bio1 (on SSD1): C{1,5,9,13,17,21}
> bio2 (on SSD2): C{2,6,10,14,18,22}
> bio3 (on SSD3): C{3,7,11,15,19,23}
> bio4 (on SSD4): C{4,8,12,16,20,24}
>
> Now we only need to call generic_make_request() for 4 times. Rebuild the
> per-device discard bios is more efficient in raid0 code then in block
> layer. There are some reasons that I know,
> - there are splice timeout, block layer cannot merge all split bio into
> one large bio before time out.
> - rebuilt per-device bio in raid0 is just by a few calculation, block
> layer does merge on queue with list operations, it is slower.
> - raid0 code knows its on disk layout, so rebuild per-device bio is
> possible here. block layer has no idea on raid0 layout, it can only do
> request merge.
>
> Avi,
>
> I compose a prototype patch, the code is not simple, indeed it is quite
> complicated IMHO.
>
> I do a little research, some NVMe SSDs support whole device size
> DISCARD, also I observe mkfs.xfs sends out a raid0 device size DISCARD
> bio to block layer. But raid0_make_request() only receives 512KB size
> DISCARD bio, block/blk-lib.c:__blkdev_issue_discard() splits the
> original large bio into 512KB small bios, the limitation is from
> q->limits.discard_granularity.
>
> At this moment, I don't know why a q->limits.discard_granularity is
> 512KB even the underlying SSD supports whole device size discard. We
> also need to fix q->limits.discard_granularity, otherwise
> block/blk-lib.c:__blkdev_issue_discard() still does an inefficient loop
> to split the original large discard bio into smaller ones and sends them
> to raid0 code by next_bio().
>
> I also CC this email to linux-block@vger.kernel.org to ask for help. My
> question is, if a NVMe SSD supports whole-device-size DISCARD, is
> q->limits.discard_granularity still necessary ?
>
> Here I also attach my prototype patch as a proof of concept, it is
> runnable with Linux 4.9-rc7.
Aha! It is not limits.discard_granularity, it is
limits.max_discard_sectors. Which is set in raid0.c:raid0_run() by
blk_queue_max_discard_sectors(). Here limits.maxZ_discard_sectors is set
to raid0 chunk size. Interesting ....
And, linux-block@vger.kernel.org, please ignore my noise.
Coly
next prev parent reply other threads:[~2016-12-07 12:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <56c83c4e-d451-07e5-88e2-40b085d8681c@scylladb.com>
[not found] ` <87oa108a1x.fsf@notabene.neil.brown.name>
[not found] ` <286a5fc1-eda3-0421-a88e-b03c09403259@scylladb.com>
[not found] ` <87inr880au.fsf@notabene.neil.brown.name>
[not found] ` <df73ebc4-9b78-09b5-022b-089c30dea17c@scylladb.com>
[not found] ` <87d1he7zv9.fsf@notabene.neil.brown.name>
[not found] ` <33bb250a-4dfd-0acc-9958-30fdac10918c@scylladb.com>
2016-12-07 11:50 ` raid0 vs. mkfs Coly Li
2016-12-07 12:03 ` Coly Li [this message]
2016-12-07 16:59 ` Shaohua Li
2016-12-08 16:44 ` Coly Li
2016-12-08 19:19 ` Shaohua Li
2016-12-09 7:34 ` Coly Li
2016-12-12 3:17 ` NeilBrown
2017-06-29 15:15 ` Avi Kivity
2017-06-29 15:31 ` Coly Li
2017-06-29 15:36 ` Avi Kivity
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=d1bc8201-7b4e-e85a-c1dc-b00c325ec23e@suse.de \
--to=colyli@suse.de \
--cc=avi@scylladb.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.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