Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95A5CC48BDF for ; Fri, 18 Jun 2021 09:13:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DC17260FD8 for ; Fri, 18 Jun 2021 09:13:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DC17260FD8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6FE976B0070; Fri, 18 Jun 2021 05:13:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 689656B0072; Fri, 18 Jun 2021 05:13:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 501706B0074; Fri, 18 Jun 2021 05:13:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0191.hostedemail.com [216.40.44.191]) by kanga.kvack.org (Postfix) with ESMTP id 1849E6B0070 for ; Fri, 18 Jun 2021 05:13:00 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A37E4180AD817 for ; Fri, 18 Jun 2021 09:12:59 +0000 (UTC) X-FDA: 78266280078.36.6D074E6 Received: from r3-22.sinamail.sina.com.cn (r3-22.sinamail.sina.com.cn [202.108.3.22]) by imf24.hostedemail.com (Postfix) with SMTP id EF6EEA000274 for ; Fri, 18 Jun 2021 09:12:57 +0000 (UTC) Received: from unknown (HELO localhost.localdomain)([221.199.207.228]) by sina.com (172.16.97.32) with ESMTP id 60CC639400015CBC; Fri, 18 Jun 2021 17:12:55 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com X-SMAIL-MID: 276563628900 From: Hillf Danton To: Michael Stapelberg Cc: Miklos Szeredi , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm , linux-fsdevel@vger.kernel.org, Tejun Heo , Dennis Zhou , Jens Axboe , Roman Gushchin , Johannes Thumshirn , Jan Kara , Song Liu , Hillf Danton , David Sterba Subject: Re: [PATCH] backing_dev_info: introduce min_bw/max_bw limits Date: Fri, 18 Jun 2021 17:12:45 +0800 Message-Id: <20210618091245.1021-1-hdanton@sina.com> In-Reply-To: References: <20210617095309.3542373-1-stapelberg+linux@google.com> MIME-Version: 1.0 Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf24.hostedemail.com: domain of hdanton@sina.com designates 202.108.3.22 as permitted sender) smtp.mailfrom=hdanton@sina.com X-Rspamd-Server: rspam02 X-Stat-Signature: 5j7kuqex9rigeage8ma6atb41q83uwe9 X-Rspamd-Queue-Id: EF6EEA000274 X-HE-Tag: 1624007577-458476 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 wrote: >> >> On Thu, 17 Jun 2021 at 11:53, Michael Stapelberg >> 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 trie= s t=3D >o >> > measure how quick file system backing devices (BDI) are able to writ= e d=3D >ata, >> > so that it can throttle processes accordingly. >> > >> > Unfortunately, certain usage patterns, such as linkers (tested with = GCC=3D >, >> > but also the Go linker) seem to hit an unfortunate corner case when = wri=3D >ting >> > their large executable output files: the kernel only ever measures >> > the (non-representative) rising slope of the starting bulk write, bu= t t=3D >he >> > whole file write is already over before the kernel could possibly me= asu=3D >re >> > the representative steady-state. >> > >> > As a consequence, with each program invocation hitting this corner c= ase=3D >, >> > the FUSE write bandwidth steadily sinks in a downward spiral, until = it >> > eventually reaches 0 (!). This results in the kernel heavily throttl= ing >> > page dirtying in programs trying to write to FUSE, which in turn man= ife=3D >sts >> > itself in slow or even entirely stalled linker processes. >> > >> > Change: >> > >> > This commit adds 2 knobs which allow avoiding this situation entirel= y o=3D >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 m= ore=3D > 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=3DE2=3D80=3D99t 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=3D3DySfe1gOr=3D3D0ituQidp= 56idGAR=3D >DKHzP0hv=3D3DERedeMrMA@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 fi= x. 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 regres= sio=3D >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/