linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: Michael Stapelberg <stapelberg+linux@google.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-mm <linux-mm@kvack.org>,
	linux-fsdevel@vger.kernel.org, Tejun Heo <tj@kernel.org>,
	Dennis Zhou <dennis@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Roman Gushchin <guro@fb.com>,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	Jan Kara <jack@suse.cz>, Song Liu <song@kernel.org>,
	Hillf Danton <hdanton@sina.com>, David Sterba <dsterba@suse.com>
Subject: Re: [PATCH] backing_dev_info: introduce min_bw/max_bw limits
Date: Fri, 18 Jun 2021 17:12:45 +0800	[thread overview]
Message-ID: <20210618091245.1021-1-hdanton@sina.com> (raw)
In-Reply-To: <CAH9Oa-ZcG0+08d=D5-rbzY-v1cdUcuW0E7D_GcwjDoC1Phf+0g@mail.gmail.com>

On Fri, 18 Jun 2021 10:31:35 +0200 Michael Stapelberg wrote:
>Hey Miklos
>
>Thanks for taking a look!
>
>On Fri, 18 Jun 2021 at 10:18, Miklos Szeredi <miklos@szeredi.hu> wrote:
>>
>> On Thu, 17 Jun 2021 at 11:53, Michael Stapelberg
>> <stapelberg+linux@google.com> wrote:
>> >
>> > These new knobs allow e.g. FUSE file systems to guide kernel memory
>> > writeback bandwidth throttling.
>> >
>> > Background:
>> >
>> > When using mmap(2) to read/write files, the page-writeback code tries t=
>o
>> > measure how quick file system backing devices (BDI) are able to write d=
>ata,
>> > so that it can throttle processes accordingly.
>> >
>> > Unfortunately, certain usage patterns, such as linkers (tested with GCC=
>,
>> > but also the Go linker) seem to hit an unfortunate corner case when wri=
>ting
>> > their large executable output files: the kernel only ever measures
>> > the (non-representative) rising slope of the starting bulk write, but t=
>he
>> > whole file write is already over before the kernel could possibly measu=
>re
>> > the representative steady-state.
>> >
>> > As a consequence, with each program invocation hitting this corner case=
>,
>> > the FUSE write bandwidth steadily sinks in a downward spiral, until it
>> > eventually reaches 0 (!). This results in the kernel heavily throttling
>> > page dirtying in programs trying to write to FUSE, which in turn manife=
>sts
>> > itself in slow or even entirely stalled linker processes.
>> >
>> > Change:
>> >
>> > This commit adds 2 knobs which allow avoiding this situation entirely o=
>n a
>> > per-file-system basis by restricting the minimum/maximum bandwidth.
>>
>>
>> This looks like  a bug in the dirty throttling heuristics, that may be
>> effecting multiple fuse based filesystems.
>>
>> Ideally the solution should be a fix to those heuristics, not adding more=
> knobs.
>
>
>Agreed.

+1

>
>>
>>
>> Is there a fundamental reason why that can't be done?    Maybe the
>> heuristics need to detect the fact that steady state has not been
>> reached, and not modify the bandwidth in that case, or something along
>> those lines.
>
>Maybe, but I don=E2=80=99t have the expertise, motivation or time to
>investigate this any further, let alone commit to get it done.
>During our previous discussion I got the impression that nobody else
>had any cycles for this either:
>https://lore.kernel.org/linux-fsdevel/CANnVG6n=3DySfe1gOr=3D0ituQidp56idGAR=
>DKHzP0hv=3DERedeMrMA@mail.gmail.com/

Its timestamp is Mon, 9 Mar 2020 16:11:41 +0100

>
>Have you had a look at the China LSF report at
>http://bardofschool.blogspot.com/2011/?
>The author of the heuristic has spent significant effort and time
>coming up with what we currently have in the kernel:
>
>"""
>Fengguang said he draw more than 10K performance graphs and read even
>more in the past year.
>"""
>
>This implies that making changes to the heuristic will not be a quick fix.

The 2019 attempt [01] IIRC was trying to cut the heuristics.

>
>I think adding these limit knobs could be useful regardless of the
>specific heuristic behavior.
>The knobs are certainly easy to understand, safe to introduce (no regressio=
>ns),
>and can be used to fix the issue at hand as well as other issues (if
>any, now or in the future).
>
>Thanks
>Best regards
>Michael

[01] https://lore.kernel.org/lkml/20191118082559.GJ6910@shao2-debian/


  reply	other threads:[~2021-06-18  9:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17  9:53 [PATCH] backing_dev_info: introduce min_bw/max_bw limits Michael Stapelberg
2021-06-18  8:18 ` Miklos Szeredi
2021-06-18  8:31   ` Michael Stapelberg
2021-06-18  9:12     ` Hillf Danton [this message]
2021-06-18 14:41     ` Miklos Szeredi
2021-06-21  9:20       ` Michael Stapelberg
2021-06-22 12:12         ` Jan Kara
2021-06-22 12:29           ` Michael Stapelberg

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=20210618091245.1021-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=dennis@kernel.org \
    --cc=dsterba@suse.com \
    --cc=guro@fb.com \
    --cc=jack@suse.cz \
    --cc=johannes.thumshirn@wdc.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=miklos@szeredi.hu \
    --cc=song@kernel.org \
    --cc=stapelberg+linux@google.com \
    --cc=tj@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).