Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1283640pxj; Fri, 18 Jun 2021 03:51:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyK12agIkryw8g/wPrXdiPiQGSdpQNYpbBf7KZklrVycPzquiatYhD+Te3iA1P9SLOgq0Qr X-Received: by 2002:a05:6402:40cc:: with SMTP id z12mr4046262edb.202.1624013470654; Fri, 18 Jun 2021 03:51:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624013470; cv=none; d=google.com; s=arc-20160816; b=k76yztaM+V0aaeERzsgTVamxIEt0MEePf9HWYT1VBO3nUtSni1eVxGBZboq+sZ3ORc WRq9s7QuoFW1O9u/t5qMOoNRAfbbZbUFTQQaxxpImadZuD/wRd86ktOUzQy6hHk5bMBR jXeK5FdqotRkJaJ3RoVFTPRxbJfh89UQCRcj2TjlhOATN6JwXA9gA+EUFqn9011R51HW TN45+8LVA0L7MMpX0a3V9wt2B+YmmtKNHDbB7LhClB7b2DRsHClNpfhi1Nw8473VDbFG lcQbGLv6Qw7GRCBTZIOEDubiq7ZAGBRvm9+vw03xvpLx390t/Ml2i29ygDFxrHldpvHM RFjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=K6oejrlNG6jfpvhOJUWCMjGYQKj/nTWi9Xf/F2Ug0Lg=; b=bLjNG9rCjKM42LwuXTmn4CipJB3WOT4l3v6mz4g8ZNeMCe0FxhQW4U4uMVtHM5xjvQ A3TyvBtpeM3Nfj61w7nVrF8qgfvhlWBEzz5NCr8acs+q+BfI+Xou3QxBWhJLkidipx+e nloXMnBv+qdyuq5917yCc7fstiUYD+Y8mgMqThYObxI6/NdMia6A6YxLWobeMOeysNbI C3gYZjSv+/MufxdrnP39wfnrDdhe/+nx2sHSfeUdB0RsNkBw5Ql/q3lb4IIMINVYkiHY IoyDaWieeALbwvrLLZvWyjUal92IaKiwgB3PbVxpPGRTPRPQYWlTvDYlLFYfJiPzTDgY HJpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=rcwqlPRW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u19si2569060edo.143.2021.06.18.03.50.46; Fri, 18 Jun 2021 03:51:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=rcwqlPRW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232891AbhFRIUq (ORCPT + 99 others); Fri, 18 Jun 2021 04:20:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232574AbhFRIUn (ORCPT ); Fri, 18 Jun 2021 04:20:43 -0400 Received: from mail-ua1-x92d.google.com (mail-ua1-x92d.google.com [IPv6:2607:f8b0:4864:20::92d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D236C06175F for ; Fri, 18 Jun 2021 01:18:33 -0700 (PDT) Received: by mail-ua1-x92d.google.com with SMTP id r9so1764488ual.7 for ; Fri, 18 Jun 2021 01:18:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=K6oejrlNG6jfpvhOJUWCMjGYQKj/nTWi9Xf/F2Ug0Lg=; b=rcwqlPRWfY9G/kpL5ukEs7Y0HtIBZ0eDNR/vormpioQwGoydGvE1C2vc76tG7rf1Aj iF8K+sbzIdEQbTPB/JFbmT8E+BDVKy7Dr/cbd3iR5DA35Gk1WqRiDLk1dLNVOOuqUDfv gUrOlwjyhvW8wKlYE4km1BmasrdghOh4X7nzU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=K6oejrlNG6jfpvhOJUWCMjGYQKj/nTWi9Xf/F2Ug0Lg=; b=pemogtqx8sbxYVVHFQx9XP/D6oNCLo01SGWqz7pInxHE3Ksdp8YPloUdg8z3AZl3Dq KAb+JF78eCmqFIDglXXFXx+r4hCc5cj5BPzzSFDSuyOKmhed1H9/U5I1J33w6ie8mPGL BjxBO+uv8BGRxEgEmAKXgOpddIZO93PLzXGbTY8JufiyY9gpmZSQpu07eUuZ+WUSZHxx OXvgFDG6/4UK3hbpkdIpOUMlv4jQJLMPcHSaje2uBQHcaTnlA5EnNnZjhSv3XQjsF4r2 HXssl6+hnDBr2zVGMiTDu3Zn3k/3O08pwWxIQiYRyih0lDbBMjtWuLTQnpKe7SaxOVpJ pFFA== X-Gm-Message-State: AOAM530g86RVHRed5U3sNn/A2gt8fPBlpYWtoen8lnjJU8UXX1Z5SHBz 41ngsR5hV33VsGWPLPPme2JLcjKHQoZC4wh3q2TakA== X-Received: by 2002:ab0:3418:: with SMTP id z24mr10555190uap.11.1624004312143; Fri, 18 Jun 2021 01:18:32 -0700 (PDT) MIME-Version: 1.0 References: <20210617095309.3542373-1-stapelberg+linux@google.com> In-Reply-To: <20210617095309.3542373-1-stapelberg+linux@google.com> From: Miklos Szeredi Date: Fri, 18 Jun 2021 10:18:21 +0200 Message-ID: Subject: Re: [PATCH] backing_dev_info: introduce min_bw/max_bw limits To: Michael Stapelberg Cc: 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 , David Sterba Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 tries to > measure how quick file system backing devices (BDI) are able to write data, > 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 writing > their large executable output files: the kernel only ever measures > the (non-representative) rising slope of the starting bulk write, but the > whole file write is already over before the kernel could possibly measure > 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 manifests > itself in slow or even entirely stalled linker processes. > > Change: > > This commit adds 2 knobs which allow avoiding this situation entirely on 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. 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. Thanks, Miklos