Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752879AbcKPNJM (ORCPT ); Wed, 16 Nov 2016 08:09:12 -0500 Received: from mail-he1eur01on0124.outbound.protection.outlook.com ([104.47.0.124]:45339 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751913AbcKPNJJ (ORCPT ); Wed, 16 Nov 2016 08:09:09 -0500 X-Greylist: delayed 28686 seconds by postgrey-1.27 at vger.kernel.org; Wed, 16 Nov 2016 08:09:08 EST Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=MPatlasov@virtuozzo.com; Subject: Re: [fuse-devel] fuse: max_background and congestion_threshold settings References: <87oa1g90nx.fsf@thinkpad.rath.org> From: Maxim Patlasov CC: linux-fsdevel , linux-kernel , Miklos Szeredi , To: Nikolaus Rath Message-ID: <64a57faa-d3a6-a209-8728-723ed7f37c2f@virtuozzo.com> Date: Tue, 15 Nov 2016 09:38:18 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <87oa1g90nx.fsf@thinkpad.rath.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [162.246.95.100] X-ClientProxiedBy: BLUPR11CA0036.namprd11.prod.outlook.com (10.141.240.46) To HE1PR0801MB1851.eurprd08.prod.outlook.com (10.168.150.147) X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1851;2:BlcuOWq7EzUXBQ903WG+PmoC4PrZm1xo34JBCOBJFLpCo6ZEhqJEmUMngBZN3EWefkOL6AGpF1y6KfwYVnj9N91zqgcz4NNfaX8d7oPiyIoYqfJVmi3v1mWwtezHpkjrxDQyIMCYTrBGU0fhLPTWo70t/ToPigUPFs0lYmgNpuo=;3:tMvGFwLNSe7ROWgyM+VPdlQyqqan4VAVF2LzxCf/p67YKBKLSlJK1XDleoWg3WGPo4fB9iF7iMJje3ZUmptHHeo4EhBUDLzYrHrPMHvfzDuPJMANvP4aP117qimutx6bxtlxAJlGgUbxZfQfSg1H+t9u5PIswQBNPgCS1X0j6YM=;25:LIkwlytmLRCKq86UegZqP37MlXyO8X/QIF+1dFxzg9Gg3XZ/LVMOJEq0KwQkhEYSxyXQT/M7AJiAVv6ofyA1ET+dCFwzT4NXi4MicYxq6vpd39Uy5WcvT5/a07JVoMjzXKUEQl9hlh3LfUfeLPQkNLoeOy7zWVCRJCJHsT/Y6VZe1YRmvCO9mDSF/We+E5mCSgWYrk4MRR56wvltN18Z5EFNgE4CgJIXK+iLJF70V7OjpkmAfN+m7r00BJvqtrEwUrGxMewYrs26rlNoSXiIcQtAnqOVyC2eGKXiD+uCQKE0zTlTr5CFuxiBDHWu9AhSOM2aZylEckAHNyL1tO28FzB+z4lnKFvIB+zlxc6apW52szKO+7BuvogMXhPz02DiA+9JqtcyHgYI9LfwamcOsYeaTYs4GjSEv/rBBk8kaHfMSR9CL0iCIpSGa94M6WpCZcJWuGBQnpCoSLANVIdqPQ== X-MS-Office365-Filtering-Correlation-Id: 66df416e-f646-4d0c-582c-08d40d7e36c0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:HE1PR0801MB1851; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1851;31:zGa6MRCPm9M1D5ViQ2Gh8xvB33Lp0PsZMRiZz1Ay9EiLrhfwr8v8kzRannqXBUkmo+yA/oez2UUkEd0DZYZhGKrqU9AMc1RUXdt9qIFA1wjsq+0l2lxvfllXq/ist4Ablg+7p5l6l4vNJklOlOaSqwOCMU5kpqsxFG55oQ6u1D1nOwjDY7OWFZmviyfDPAEP82Xn+80hRtnb54ZId9VOP5D9PTwSe1Uv0OlhPdbLBIhFdwwB5F+OqBmAtAQ6PLpRDGMizssA4AWV+mNUGbHwqfM74vD1k9TZudYdafGcSAM=;20:yczomX45MhkMZefADdubMqbOnPuwrvsagJ+GNz93JTSoijFOpK7I3RbWSGeuek3fjucafBiDD6Q+4pEzAALmwEQSXBCOOQgT04H19EGIlZLYwqByEtRrJ13tVt8sddmNDoEOzF5v6MmgXyurasmJcL3D67UNC4XW0qBb4UH4Dmo=;4:8h9OdZN2/l17E+L2Q+Mz2iG0cQwdN0lnU4d/Q43CtVgcRuiRx/FK2EO4HEcy82XeUVr7MacK+HvAD0t0krakGMsJ9H0SFXw1HvNC1Oefyt1UNnZXkPHdSVvjH98o1uD3eAGrHzESky6QeGeiZxjSyl/9gVCxpeZhFd+d6iWz4AOemx4Anux0Ttghz4HQb72/pTItOc25j9Lcu8j0J05X6+InnVzTHTnmZ2nsgs1BFoXGAqVJmxK4aTuVjX7Xdhp/Y3DtCxf92oseWgF44mUohNjIJckTlvY7R6e3X/KnwXVQbWK9EuVlAbpgxZjpQscW7zKt3M8YiUKe93aRX1YELEF45FE+m1XKQqIILsViuLZFSS1rBke0/O1DypHFs0f3ooFPVQKk6PuJVhRU2K+pnpMWpd+MqOXeh0Hzt7vnQGnip/ubKLVFrdx/L2qxmQPB X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6060326)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6061324)(6043046);SRVR:HE1PR0801MB1851;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB1851; X-Forefront-PRVS: 012792EC17 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(7916002)(24454002)(189002)(199003)(377454003)(92566002)(8676002)(54356999)(80792005)(42186005)(68736007)(65826007)(5660300001)(97736004)(76176999)(66066001)(50466002)(64126003)(6916009)(189998001)(4001350100001)(2950100002)(6666003)(65806001)(47776003)(65956001)(229853002)(2906002)(23676002)(50986999)(4326007)(101416001)(105586002)(36756003)(230700001)(31686004)(31696002)(110136003)(7736002)(305945005)(6116002)(33646002)(77096005)(86362001)(81166006)(83506001)(3846002)(7846002)(81156014)(106356001)(7099028);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0801MB1851;H:[10.161.30.31];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQUjA4MDFNQjE4NTE7MjM6YVNMQ29yK0pPRDV2Z2dvMjFpUUg4Y0pJ?= =?utf-8?B?anFrSi82WkhHc1FDb01admcxZE5zSWRkTXZSYkJLZlNieWhNdGJvSk5uMHRz?= =?utf-8?B?cDdTdjdmdDdIWkl6REF5d01ObFFrT2pCSzZwakpIUmlkcjA0enkwZUJCbEVG?= =?utf-8?B?djlZMy9WZU8reTJsbHlzUTFaS1BRaVRqdlFWYTNVd2dWSnQ3d0kyWXlhdEgx?= =?utf-8?B?NDkxMnlDNUpQM2UyKzZoMVFEZVFUblFyOWZabkJ0M2k1MnkvN1phT29id1JY?= =?utf-8?B?NVRoMWFqQ05ZUTJqK001T1VtZ283ZTh4RVQwek50aE9vaCtNNElsb3NDUCtI?= =?utf-8?B?UFpydmNsOVNkSkJ2WklzMERjaEtQeGFzemVSK2VKWnI1MkVRaVQxeHhYRnFN?= =?utf-8?B?Zm5nRFYzS1hTdittVnA0T0ZrRzJxY0xGR2tROXQ2L0g3UVJ5REhYZGlzWnJl?= =?utf-8?B?aEFoaUpuNklaenoyS3Y5Y2ZoSDZkUExNZ21nSVNDSjdsREpHdW84ZFg0UUI2?= =?utf-8?B?TTd3TG5hRC8xcUIrR0x6WEJCTzg3T2ErZzR0YUk3ODJDQUpHS2FobUpkc0pv?= =?utf-8?B?QlFCWkRvQjVMMWt3Nll6RW9pMjY0TG14Mkw4QXZJSENKMTdvVGVwYUNpeVJt?= =?utf-8?B?djVVWmhmR1lPclpEVXgwdkdTdlhlWWoyQzBJOUZIcGVkREdwOFpIREZ3anA0?= =?utf-8?B?UVY1eHk4bHB3UDI5RTBtbjRCSitTTHlsLzUzRXRKcF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PPom+eCOITUTFlbkYOMiyuLwn8d2coF1Qw5tpxLUCDVK44ImfsKaMpuNXoq0zLOBRywAek8MI5Av+Z5m2ohlzECSRsYOqlM876LeutwzIZz03Nx9F/ZDUgo0Q1088W9APz2HyAeUm/LzgNqqjOdH1HpBAotaApZ/jT8B3GK8NUC01iubFgVz0Dd71koGSbxpnVN/hIhEddeliB7GekVQ/6GOI5VmhTw=;20:A24FdJv1+32BnPJNZDIlEJooESPTkOfaHpqkBhaMjo/eGvT1TNQ4BUyc2Ej1c6YGWqFdxDtPZrH7Ob7jIIa/S1MwWnIBg6pQp8QuwmVH5p5VxlSoGdRKIcjW3m08gGqCtApEeXfBsPhSEukuq7oKUpSXWATdLbUmP8HoPKPXGwg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2016 17:38:28.7666 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1851 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1904 Lines: 49 Hi, On 11/15/2016 08:18 AM, Nikolaus Rath wrote: > Hello, > > Could someone explain to me the meaning of the max_background and > congestion_threshold settings of the fuse module? > > At first I assumed that max_background specifies the maximum number of > pending requests (i.e., requests that have been send to userspace but > for which no reply was received yet). But looking at fs/fuse/dev.c, it > looks as if not every request is included in this number. fuse uses max_background for cases where the total number of simultaneous requests of given type is not limited by some other natural means. AFAIU, these cases are: 1) async processing of direct IO; 2) read-ahead. As an example of "natural" limitation: when userspace process blocks on a sync direct IO read/write, the number of requests fuse consumed is limited by the number of such processes (actually their threads). In contrast, if userspace requests 1GB direct IO read/write, it would be unreasonable to issue 1GB/128K==8192 fuse requests simultaneously. That's where max_background steps in. > > I also figured out that if the number of background requests (whatever > they are) exceeds the congestion threshold, fuse calls > set_bdi_congested() for the backing device. But what does this do? AFAIU, this is a hint for reclaimer to avoid busy loop: > /* > * If kswapd scans pages marked marked for immediate > * reclaim and under writeback (nr_immediate), it implies > * that pages are cycling through the LRU faster than > * they are written so also forcibly stall. > */ > if (nr_immediate && current_may_throttle()) > congestion_wait(BLK_RW_ASYNC, HZ/10); > And > does this become a no-op if there is no backing device? current->backing_dev_info exists (and helps to control writeback) even if there is no "real" backing device. Thanks, Maxim