Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941332AbcKQGxj (ORCPT ); Thu, 17 Nov 2016 01:53:39 -0500 Received: from mail-db5eur01on0107.outbound.protection.outlook.com ([104.47.2.107]:14272 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S938562AbcKQGxf (ORCPT ); Thu, 17 Nov 2016 01:53:35 -0500 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> <64a57faa-d3a6-a209-8728-723ed7f37c2f@virtuozzo.com> <87fumrmdvn.fsf@thinkpad.rath.org> From: Maxim Patlasov CC: linux-kernel , Miklos Szeredi , , linux-fsdevel To: Nikolaus Rath Message-ID: <716677ab-f962-1628-205b-2326219f4487@virtuozzo.com> Date: Wed, 16 Nov 2016 11:56:10 -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: <87fumrmdvn.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: CO2PR20CA0024.namprd20.prod.outlook.com (10.163.96.34) To VI1PR0801MB1853.eurprd08.prod.outlook.com (10.168.68.14) X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1853;2:DKJGiCu0oSYi7dySoBNwzUhLhmyzuNdtb6vm8s3ROaffYy1bmu0+YF+V9fvkEP07hetzHTf2QsMV1D9bvv5tLN6mzMuFhpA5rvi8Ve4uW7YctVMt9Iu5Idj4C0XTj2gSoHQUPDujwUPcCoPHazk0ZNioc+xbBLvxetddn0zeBNE=;3:SSdNVwxsEu5tcLMCbD0HA8lqyP3aeuyvBAqjzEXiiRrLZkv5Gj0FKNnqN9dO4gxscsaOWNIp6/PWopwVbBJhkhHk2v6YFjs2BZm0xCMQf5b9UgdVRGwjBXZBtu8f5XaJWB2fA0qDDbYjd+2EHqEPrKBeMm6r7Dtn/SuE2CRgBmo=;25:aRx+zXtCLISO1oDxh04Er5H5DoQznMfMeUJseWhFEfnscpn945R7BIhYz0DTisSWugsRlMl34wHmcR4bmub3PQdiIVfT4veAt/CTm1++FkaBY1R/xRuxEhzwAOfKoAfPLrd3kfoIUodydBpvsbD45/nfrbQC0vcoigSOE5RUs8lnqurOKG4uUS/TY4ZsaAiebI8bcKViK7TDy6nvSx0hFe/qBjL+LwGKzIsfw/J/Bz5C5CxT5fipCRGZyAkQjJ08Jfdfuk5AGxnIX1hrXmZMTCdEizY7NjEwVUurbhHH0Tm1qQ1nXZtjNJS1UJId7E6p4dH6pyr7n6BW9Zz4ZoM/m2+GJKkdncQwrN82nUZ+nzTLmD+TS2oWCK2HlUBzCrJKqVBoaTQ+bGvcBdz4MySNDVeCrQ7OczFuLpDGcbZB4UC0QL8ZkygY7Y2LQY/bsJzqHsBNACNRHJTBA5upZYSH5Q== X-MS-Office365-Filtering-Correlation-Id: 4bdf1cfc-4bcf-42f8-07fb-08d40e5aa5ed X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:VI1PR0801MB1853; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1853;31:C/KzTZWgqt9r5Ai/mwHfGXmKEdiBgINg4y5aivT//ooPXwdniLfdZxDw4EbCwYA3PrcJqYmZmf0BXHz+BAdkzHwGH9H1wu+z9m3I35vuCz0iYThhZkyLVw1gW1sAE3lpH7yu0kznfylLtVJ2myFxFnQjyLT1uhDxsxDsMW+gOs6Diode7pqRfit7cngKo8m4GWqp2hOMVg8O9DL5WtH6iEQ8kBEbuNUl+dFzyaJJwgjpntz2e7M2mxjrAMbMpMAc5/jteEAmO/nifll/IzR7hQ==;20:bECv6NLM7i5NLSjwKgZCMeFL0wuEpDqRguqnOOQBWnLhwVgl2tQRlIbLbYC767UHgsXFqYG/b9PqURgqB25VT+HEOm+M08SWYneefu3ey9eGsq2VNoEvfz3YnCE1iwFa0cpNHTEyDgf7X598KMuYD7rVOAnuSKyMUY2ezi1n+Io= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6060326)(6040281)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6061324)(6041223)(6043046);SRVR:VI1PR0801MB1853;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB1853; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1853;4:FzcYYExsez7vTvp+xxbvZMzv6vcl5tdNoQGHiu7ISW4lceqBpSwiYxZlR0toi7tsgh8Gm7aARnrPgeAnbrFoPNifeYXvSOpD6Pt5I+Mrktjs+QbZ2Z2LswCDvDAWYd7uGs5MKGheiAz2G985Sko2qit8nGoic8KLW4FZeRNOq1kpth3u3qnMG9nELsLYtNtV0FBpY1tmejImpictDcPu1CmVhbxro0XvTbxlwGT/KuI2gr88iqs9URGoEjf9/kwDpLjrAu0XHkFbbkSBhQwYZFJQi1gL4cUNC/NWYqPhZ+wOxlztLRrR5emHzQ1QIYb4yXDA80pY1EJtqUiO6T16Qn2jwls7+VU5uN7BdKGME9dEqknH/SPKWSQeogQnpB2IsqR7GkbClf8cnWykeRH/cZtfY+9YpMdiBPW8vWqgYhAkz8XxuDgQhTeIvtHEUHgMa5/W/Q+P0OiyND/MRjTsL3ExpsQRl2gT3j0LnWcNV94= X-Forefront-PRVS: 01283822F8 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(7916002)(52314003)(199003)(189002)(24454002)(51444003)(377454003)(101416001)(76176999)(50986999)(54356999)(33646002)(23676002)(3846002)(6116002)(42186005)(31686004)(4326007)(6916009)(2906002)(106356001)(105586002)(110136003)(2950100002)(6666003)(8676002)(229853002)(65956001)(81156014)(5660300001)(4001350100001)(80792005)(92566002)(47776003)(81166006)(65826007)(97736004)(68736007)(230700001)(77096005)(36756003)(83506001)(50466002)(31696002)(7736002)(7846002)(189998001)(86362001)(66066001)(305945005)(64126003)(65806001)(7099028);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB1853;H:[10.161.30.31];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtWSTFQUjA4MDFNQjE4NTM7MjM6bFRyNjRiZHVobkZCVGdKditHZjdrdlQz?= =?utf-8?B?UGdqbmF1VlVuckllM0pqL2d5KzdsRnRhRVVsQy9LcitqUG1sd2FJbDQ1SmRN?= =?utf-8?B?UXZiN1YzWmhYdFVoakZyaWhOZ1JzajdLeG12MFAvMmV3akhUdzRPdlIxT2w0?= =?utf-8?B?SXAxZVVrZzZubWNWN1RnMjVGWjhqQVZ4dzlxUmRwWVJpcFBaVzQrUHVnUkZo?= =?utf-8?B?dndZa0JWZWZhL0xLNUpDWTJkVnFQdlFXZnU2V1VKT0VDRmhNdUs1WTJwdTd2?= =?utf-8?B?Uks5V2VBWEd6OUdXUzJQb1dENGhUSVNPT2UvZ1BXWWJPWmptV29VVlV4Y29N?= =?utf-8?B?Q0o2N2g3ZzB1ZW1pRmg0VjdCY2FOVjhYdUkyakxESzhqYW9KNTNqekloeC9j?= =?utf-8?B?REt6N2FYbUZGN2xxRHpPaG1nUGRBNm5aS1ppaE52NnFQUWhGMno4citnNTYy?= =?utf-8?B?WDluMjBCRVFjZ1dkaFk3R2lnUHpsMTRSVnlMd3krdVJPY0ppVEVxbDVaTzFr?= =?utf-8?B?MW1aQXNIdEFRVjVHVXdQNkgzSDFLNTdzZEUxSE1sTkRCUTB2TUdtSXNHOFFy?= =?utf-8?B?R1dyRDZhdDJQSitJYUZDR2Z6R0puRG40L3VDNEJKMDgzQkxkRnpacXc0eGRy?= =?utf-8?B?aVVPcTZnSERueWEvKzZQbF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put: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1853;7:a3Yp5EWiKj6ytfKZV3N+tY6C9Q4DZS1ztBofhd2MhGOhtOrkYO2Vmt8DEhhEKwq7AOYtRHoBbFmCgunu8UHv7jcC6EOkASetnSclL2TGnkcAmnQo8rKMuZ/Av4tCzB7XZO2md1fvXT9lwkif4GkvIgdNTJk+2ChApOcNMWEYwlCM/I2kHuL2X9mzkLACd9Wm3qBhy4vZL6MFDeVZVsbfpcj8mJSoGjV47QFkCXikhz71zO55xUJ5PS29eAotZ48a9IFVYz/zI7R1eLQ2o1Raw3cwWbrwVlrwRF2vKQYk6XVYTBApRtBuESKHe6RNnslxIih0H5lWvxezBWRWb396k/NlK1WURFv8SVzZSlQxeVw=;20:JcwwPbyZkGxw1GaPYiHJzk3t0dbcuqzroiFmQkxclHj1DgKOd31zZZoFBCz9UW7mVvlbkBU/k3nlJd+b2SMbuBuQMZypgQ6EAWMykabc05TSoQbt0Ii9iQUOO7EUBoWsNv9Fgj9rIkaGieKpRyp3EThDseKzvv1PRbbKqe/1Dd4=;23:sdAq5ekh8HUNxK/g3RKzjI5f7iGgjKR0a6iiUkf/Fk+NdCMKauVTw4U30+f9gF2SWcCjGkgt7whZt3CLlpc7MhW4UrQNdyVib0c3NZn+2a82dIRmdm0/aj8z9QmfnL0ClrTmIFROH6IdboYSf+RoaLIwpoMq9C9uqagk882ZqZQ/sgmGTjFoN7O+t+gVso57 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2016 19:56:24.8113 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1853 X-OriginatorOrg: virtuozzo.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2912 Lines: 56 On 11/16/2016 11:19 AM, Nikolaus Rath wrote: > Hi Maxim, > > On Nov 15 2016, Maxim Patlasov wrote: >> On 11/15/2016 08:18 AM, Nikolaus Rath wrote: >>> 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. > Ah, that makes sense. Are these two cases meant as examples, or is that > an exhaustive list? Because I would have thought that other cases should > be writing of cached data (when writeback caching is enabled), and > asynchronous I/O from userspace...? I think that's exhaustive list, but I can miss something. As for writing of cached data, that definitely doesn't go through background requests. Here we rely on flusher: fuse will allocate as many requests as the flusher wants to writeback. Buffered AIO READs actually block in submit_io until fully processed. So it's just another example of "natural" limitation I told above. Buffered AIO WRITEs go through writeback mechanics anyway, so here again we rely on flusher behaving reasonable. And finally, direct AIO does go through fuse background requests as I wrote: "1) async processing of direct IO;" > > Also, I am not sure what you mean with async processing of direct > I/O. Shouldn't direct I/O always go directly to the file-system? If so, > how can it be processed asynchronously? That's a nice optimization we implemented a few years ago: having incoming sync direct IO request of 1MB size, kernel fuse splits it into eight 128K requests and starts processing them in async manner, waiting for the completion of all of them before completing that incoming 1MB requests. This boosts performance tremendously if userspace fuse daemon is able to efficiently process many requests "in parallel". This optimization is implemented using background fuse requests. Otherwise, having 1GB incoming request, we would obediently allocate 8K fuse requests in one shot -- too dangerous and not good for latency. Thanks, Maxim