Linux block layer
 help / color / mirror / Atom feed
From: aaronlee0817  <aaronlee0817@163.com>
To: "Tejun Heo" <tj@kernel.org>
Cc: "Ming Lei" <tom.leiming@gmail.com>,
	"Jens Axboe" <axboe@kernel.dk>, "Ming Lin" <mlin@kernel.org>,
	"Shaohua Li" <shli@kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	cgroup@vger.kernel.org, jiale0817.li@samsung.com,
	yanzi.zhang@samsung.com, zhen1.zhang@samsung.com,
	linux-block <linux-block@vger.kernel.org>
Subject: Re:Re: cgroup: Fix split bio been throttled more than once
Date: Thu, 7 Jul 2016 21:48:04 +0800 (CST)	[thread overview]
Message-ID: <27824f6f.127ab.155c59d8a24.Coremail.aaronlee0817@163.com> (raw)
In-Reply-To: <20160706140919.GH3262@mtj.duckdns.org>

[-- Attachment #1: Type: text/plain, Size: 2314 bytes --]

>At 2016-07-06 22:09:19, "Tejun Heo" <tj@kernel.org> wrote:
>Hello, Ming.
>
>On Wed, Jul 06, 2016 at 09:10:00AM +0800, Ming Lei wrote:
>> > Then we did some research and find that in kernel version 4.3 brought in
>> > blk_queue_split() function to split the big size bio into several parts,
>> > and some of them are calling the generic_make_request() again, this result
>> > the bio been throttled more than once. so the actual bio sent to device is
>> > less than we expected.
>> 
>> Except for blk_queue_split(), there are other(stacked) drivers which call
>> generic_make_request() too, such as drbd, dm, md and bcache.
>
>So, blk-throtl already uses REQ_THROTTLED to avoid throttling the same
>bio multiple times.  The problem seems that the flag isn't maintained
>through clone.

Yea, REQ_THROTTLED is used to avoid throttling the same bio multiple times, 
but cannot avoid counting the same bio multiple times, this makes the counts of
dispatched bytes no real.
Before bringing in splitting, it works well.But now, this cannot cover all  scenarios.
For example:


generic_make_request()
blk_throtl_bio
    bool throttled = false
    throtl_charge_bio()      count the bytes, set REQ_THROTTLED
    goto out
    if(!throttled)
        clean REQ_THROTTLED       
    return 


Before return, REQ_THROTTLED will be cleaned.
While splitting will copy bio->rw, but REQ_THROTTLED has been cleaned.
So throttling function will count the bytes again. In this scenario  cannot 
avoid counting the same bio multiple times.  


>
>> >
>> > We have checked the newest kernel of 4.7-rc5, this problem is still exist.
>> >
>> > Based on this kind of situation, we propose a fix solution to add a flag bit
>> > in bio to let the splited bio bypass the blk_queue_split(). Below is the patch
>> > we used to fix this problem.
>> 
>> The splitted bio is just a fast-cloned bio(except for discard bio) and not very
>> special compared with other fast-cloned bio, which is quite common used.
>> 
>> So I guess what you need is to bypass BIO_CLONED bio for this purpose
>> since all fast-cloned bio shares the same bvec table of the source bio.
>
>Depending on how a device handles a bio, that could allow bios to
>bypass throttling entirely, no?  Wouldn't adding REQ_THROTTLED to
>REQ_CLONE_MASK work?
>
>Thanks.
>
>-- 
>tejun

[-- Attachment #2: Type: text/html, Size: 2972 bytes --]

  parent reply	other threads:[~2016-07-07 13:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <77238e99.142c5.155b660564f.Coremail.aaronlee0817@163.com>
2016-07-06  1:10 ` cgroup: Fix split bio been throttled more than once Ming Lei
2016-07-06 14:09   ` Tejun Heo
2016-07-06 14:53     ` Ming Lei
2016-07-07 13:48     ` aaronlee0817 [this message]
2016-07-08 10:35       ` Ming Lei
2016-07-09 14:53         ` Tejun Heo
2016-07-10  8:58           ` Ming Lei
2016-07-06 14:57   ` aaronlee0817
     [not found] ` <20160705222626.GC25394@htj.duckdns.org>
2016-07-06  1:14   ` Ming Lei
2016-07-06 14:58   ` aaronlee0817
2016-07-06 15:06     ` Tejun Heo
2016-07-06 15:17       ` aaronlee0817
2016-07-06 15:39       ` Ming Lei

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=27824f6f.127ab.155c59d8a24.Coremail.aaronlee0817@163.com \
    --to=aaronlee0817@163.com \
    --cc=axboe@kernel.dk \
    --cc=cgroup@vger.kernel.org \
    --cc=jiale0817.li@samsung.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlin@kernel.org \
    --cc=shli@kernel.org \
    --cc=tj@kernel.org \
    --cc=tom.leiming@gmail.com \
    --cc=yanzi.zhang@samsung.com \
    --cc=zhen1.zhang@samsung.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