linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@fb.com>
To: Jan Kara <jack@suse.cz>
Cc: <axboe@kernel.dk>, <linux-kernel@vger.kernel.org>,
	<linux-fsdevel@vger.kernel.org>, <linux-block@vger.kernel.org>,
	<hch@lst.de>
Subject: Re: [PATCH 8/8] block: hook up writeback throttling
Date: Tue, 8 Nov 2016 08:16:35 -0700	[thread overview]
Message-ID: <7f0701c4-d8b6-85ad-30a6-ff48401a66f3@fb.com> (raw)
In-Reply-To: <20161108134233.GR32353@quack2.suse.cz>

On 11/08/2016 06:42 AM, Jan Kara wrote:
> On Tue 01-11-16 15:08:51, Jens Axboe wrote:
>> Enable throttling of buffered writeback to make it a lot
>> more smooth, and has way less impact on other system activity.
>> Background writeback should be, by definition, background
>> activity. The fact that we flush huge bundles of it at the time
>> means that it potentially has heavy impacts on foreground workloads,
>> which isn't ideal. We can't easily limit the sizes of writes that
>> we do, since that would impact file system layout in the presence
>> of delayed allocation. So just throttle back buffered writeback,
>> unless someone is waiting for it.
>>
>> The algorithm for when to throttle takes its inspiration in the
>> CoDel networking scheduling algorithm. Like CoDel, blk-wb monitors
>> the minimum latencies of requests over a window of time. In that
>> window of time, if the minimum latency of any request exceeds a
>> given target, then a scale count is incremented and the queue depth
>> is shrunk. The next monitoring window is shrunk accordingly. Unlike
>> CoDel, if we hit a window that exhibits good behavior, then we
>> simply increment the scale count and re-calculate the limits for that
>> scale value. This prevents us from oscillating between a
>> close-to-ideal value and max all the time, instead remaining in the
>> windows where we get good behavior.
>>
>> Unlike CoDel, blk-wb allows the scale count to to negative. This
>> happens if we primarily have writes going on. Unlike positive
>> scale counts, this doesn't change the size of the monitoring window.
>> When the heavy writers finish, blk-bw quickly snaps back to it's
>> stable state of a zero scale count.
>>
>> The patch registers two sysfs entries. The first one, 'wb_window_usec',
>> defines the window of monitoring. The second one, 'wb_lat_usec',
>> sets the latency target for the window. It defaults to 2 msec for
>> non-rotational storage, and 75 msec for rotational storage. Setting
>> this value to '0' disables blk-wb. Generally, a user would not have
>> to touch these settings.
>>
>> We don't enable WBT on devices that are managed with CFQ, and have
>> a non-root block cgroup attached. If we have a proportional share setup
>> on this particular disk, then the wbt throttling will interfere with
>> that. We don't have a strong need for wbt for that case, since we will
>> rely on CFQ doing that for us.
>
> Just one nit: Don't you miss wbt_exit() call for legacy block layer? I
> don't see where that happens.

Huh yes, good point, that must have been lost along the way. I'll readd
it.

-- 
Jens Axboe

  reply	other threads:[~2016-11-08 15:16 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01 21:08 [PATCHSET] Throttled buffered writeback Jens Axboe
2016-11-01 21:08 ` [PATCH 1/8] block: add WRITE_BACKGROUND Jens Axboe
2016-11-02 14:55   ` Christoph Hellwig
2016-11-02 16:22     ` Jens Axboe
2016-11-05 22:27   ` Jan Kara
2016-11-01 21:08 ` [PATCH 2/8] writeback: add wbc_to_write_flags() Jens Axboe
2016-11-02 14:56   ` Christoph Hellwig
2016-11-01 21:08 ` [PATCH 3/8] writeback: mark background writeback as such Jens Axboe
2016-11-02 14:56   ` Christoph Hellwig
2016-11-05 22:26   ` Jan Kara
2016-11-01 21:08 ` [PATCH 4/8] writeback: track if we're sleeping on progress in balance_dirty_pages() Jens Axboe
2016-11-02 14:57   ` Christoph Hellwig
2016-11-02 14:59     ` Jens Axboe
2016-11-08 13:02   ` Jan Kara
2016-11-01 21:08 ` [PATCH 5/8] block: add code to track actual device queue depth Jens Axboe
2016-11-02 14:59   ` Christoph Hellwig
2016-11-02 15:02     ` Jens Axboe
2016-11-02 16:40       ` Johannes Thumshirn
2016-11-05 22:37   ` Jan Kara
2016-11-01 21:08 ` [PATCH 6/8] block: add scalable completion tracking of requests Jens Axboe
2016-11-08 13:30   ` Jan Kara
2016-11-08 15:25     ` Jens Axboe
2016-11-09  9:01       ` Jan Kara
2016-11-09 16:09         ` Jens Axboe
2016-11-09 19:52           ` Jens Axboe
2016-11-10 19:38             ` Jan Kara
2016-11-12  5:19               ` Jens Axboe
2016-11-01 21:08 ` [PATCH 7/8] blk-wbt: add general throttling mechanism Jens Axboe
2016-11-08 13:39   ` Jan Kara
2016-11-08 15:41     ` Jens Axboe
2016-11-09  8:40       ` Jan Kara
2016-11-09 16:07         ` Jens Axboe
2016-11-09 19:52           ` Jens Axboe
2016-11-10 19:36             ` Jan Kara
2016-11-10  0:00           ` Dave Chinner
2016-11-01 21:08 ` [PATCH 8/8] block: hook up writeback throttling Jens Axboe
2016-11-08 13:42   ` Jan Kara
2016-11-08 15:16     ` Jens Axboe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-10-26 20:52 [PATCHSET] block: buffered " Jens Axboe
2016-10-26 20:52 ` [PATCH 8/8] block: hook up " Jens Axboe

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=7f0701c4-d8b6-85ad-30a6-ff48401a66f3@fb.com \
    --to=axboe@fb.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).