Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753297AbcKHPQx (ORCPT ); Tue, 8 Nov 2016 10:16:53 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:44346 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751546AbcKHPQt (ORCPT ); Tue, 8 Nov 2016 10:16:49 -0500 Subject: Re: [PATCH 8/8] block: hook up writeback throttling To: Jan Kara References: <1478034531-28559-1-git-send-email-axboe@fb.com> <1478034531-28559-9-git-send-email-axboe@fb.com> <20161108134233.GR32353@quack2.suse.cz> CC: , , , , From: Jens Axboe Message-ID: <7f0701c4-d8b6-85ad-30a6-ff48401a66f3@fb.com> Date: Tue, 8 Nov 2016 08:16:35 -0700 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: <20161108134233.GR32353@quack2.suse.cz> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [216.160.245.98] X-ClientProxiedBy: DM3PR10CA0031.namprd10.prod.outlook.com (10.164.12.41) To DM5PR15MB1193.namprd15.prod.outlook.com (10.173.209.11) X-MS-Office365-Filtering-Correlation-Id: 2d26edd9-fbeb-4166-241e-08d407ea3d6d X-Microsoft-Exchange-Diagnostics: 1;DM5PR15MB1193;2:wlsd8DCMiP73D7+grf4nOSwFecPnjgbmZK5ZWNFktmrhShOnUpvyV2oDhc4bf1EVkTs37SCp8q8D+khfavSEPZ8sbVrfjSH2F1vvJoar4zD+YQtbsnAgIHMRJY8/wtKZ3hjHjEpzQLCXDe3zwFml5tc625lnp7ZoDD7bWABEqxh6bbOGFDHsEF2q6RvhCieOTKb/U5hW6f3eDsou+AzgOg==;3:jLwJL7oDBR9LDJ8qf6Ec8lvK76PcWRoC1MtwimwgukNlAdqIuymC7baWuZwV0DDbE1z2iIXzKIOOp8V87GUE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2UQDiZXvbXeMX0aM6AwYuwayZZEL8OScZVLM6ra3kYVX2WGVVf2Z/h8F432esY78NlVdFp9nq6rr8NGkF3AnK8uA33OIe5dBj07TUYQICBCEknCShNXX9R6kJKcrFF7SurtXY99ZDKVlU73WXYzShjyTeseC5VK1Eg/161cXedR9ujkLg3lnR36rbNSNVeLHSqpWwnWAhj0Oe57hpzAKkazydsIUSrjyzRNs9RxhX3Zif4xLcrvJxc6IAM2HziJ5wefS9aUJ4AaXP9bXfpYt2yeWTBLgfPdAhRD7qBejjSr8372NBLP5T7tupKQ3RqzRoVHxHmturqd/UfnNZkJIbisHRC6Nhw5wZ/Y/0CEtLEVzJGW+wJT+e+fZmaXxyrinbt7uQkNiLG1ruvxh9AaCywSSHqUlppkWU8S6o0M X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72170088055959); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001);SRVR:DM5PR15MB1193;BCL:0;PCL:0;RULEID:;SRVR:DM5PR15MB1193; X-Forefront-PRVS: 01208B1E18 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(7916002)(377454003)(189002)(199003)(377424004)(24454002)(586003)(31696002)(31686004)(42186005)(110136003)(81166006)(7846002)(50466002)(2906002)(117156001)(230700001)(33646002)(5660300001)(64126003)(47776003)(101416001)(3846002)(6916009)(6116002)(81156014)(4326007)(2950100002)(65826007)(6666003)(68736007)(23746002)(86362001)(106356001)(36756003)(105586002)(5890100001)(97736004)(189998001)(83506001)(50986999)(65956001)(76176999)(305945005)(54356999)(8676002)(66066001)(77096005)(65806001)(92566002)(7736002)(4001350100001)(52103001)(158003001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR15MB1193;H:[192.168.1.153];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DM5PR15MB1193;23:GxELn+I6X+VLYtEgUtuKuWpIqrPP7NnKW3smP?= =?Windows-1252?Q?8qpJ3aT0i9wXOueDeAa2xJvWjHvs00tdNmS7+ooUHhE/lHItS4gr5hwi?= =?Windows-1252?Q?Dwozi9XyNDw2g5ohtT6zurM8BAkIUVJ7akDbh+UJw9OnBQoHsNuTVp+J?= =?Windows-1252?Q?LfMwkhtbddzo/Pr1M8yCW6dAbayhD3eZzlpvpSYdKZa3LU4cfMPtXTH2?= =?Windows-1252?Q?qoNQaZ2GjYtXwiaHb7gzCZTyIWPqBWtq0tTc9gJE27ZWwNqBWVsa/WEM?= =?Windows-1252?Q?uokx58fUMW/5pWltNv7CwdDPqRHFbpQGN/OSbqCwxekY2jd6tGPaUsvf?= =?Windows-1252?Q?xDggn4tvtE4kwWGUAif4nUWgBiotW9y6DBTrsBXR6/+GmiMTUq5NA6B0?= =?Windows-1252?Q?/UTQFxqX9bytO4MWOPTFs1Q3rI5MXg+YgPqagxUQfga50wneNdEVJB1c?= =?Windows-1252?Q?+D8aLOT0RAEFlDqOxLS/O7f/xtWO2WXVbXwp6QOyY8BIl77IJhkwON9t?= =?Windows-1252?Q?NL/F7oNZrfBaqklNK2GUSRpH04H4Bqt4F038xHSSqq32/jatArWDXRWA?= =?Windows-1252?Q?NOOSA6BQX8LNet8YMiCKIqdKfpZzoCWONPverHuh9m4gu6ujourcvUU6?= =?Windows-1252?Q?tA7jmaDaSefIRMYvAX4W5Uu7jejUY53Ht5hi63m7YWRXbWkXwzHZQufA?= =?Windows-1252?Q?C+HmbVmFwzW4lO0jHrrxSB0ePPYwe6rx3yvm2Xms89s/ONBMM3R3NB2V?= =?Windows-1252?Q?Nllw8dMZO7ry8BZXwS8hbBKKTJ16zRYKpRYI37200/XX/UzGyivZUYgV?= =?Windows-1252?Q?NxpUkGaQkLLMEyV5pPVTX9OOuTiy+b+/3q5L2jI2Z8amM2aui6I6sKGl?= =?Windows-1252?Q?nKCznCXMxv4n5TTnS34Kkr+5fQ5+zmtzffB6kGPuqBNqwdBTfkxo2nc6?= =?Windows-1252?Q?uNS9i8eJueb+fsOXbaCc8t1BgrgLbIL4JVqp4ahQLIqVOgL3isjo3XZ+?= =?Windows-1252?Q?YCQZNEbfqAGY4P2KMhY0Yzj8nMTXd13LZqP92dTdI1gJhm2hhXImbN0S?= =?Windows-1252?Q?P3P5UwtjIXPVY2SE0+xdsAWbAP930cKL2SwI7JJ9zXXTh2rw5En4ZjEX?= =?Windows-1252?Q?6tkb2HvxZgEe0Ic9rz44acJ/WgyRG6vQDG5rhbYVuCzaSiyzlyyhS9dU?= =?Windows-1252?Q?yT8hXU37gv5rfYn9+mRKith+mB3JI/duvPa/9DpvL5NFCaXH2JW97dM5?= =?Windows-1252?Q?zavnh7+geote80iISDePsSYUxogGZnETJvV5XVYLlZ2uZ+oC2YFEv6Pk?= =?Windows-1252?Q?fR8AU+OEptZmbHy4ZSlCq03FuwZ6M8/6eGrl4mNIt2nMcd016XgDpzw0?= =?Windows-1252?Q?h7hprlRtXiycrGdmZY7UFJ/LYoiEP40NWj5pNBZGOMTYzFh9s5K1BO0s?= =?Windows-1252?Q?S9yUGUthxe6qGTjG1ZOjzmfVuEAtOmpvtRlWRevunJgiVMNsI2zIsxz4?= =?Windows-1252?Q?iWhWgjnqkDGJ9iDMqYCQtVoXi+r?= X-Microsoft-Exchange-Diagnostics: 1;DM5PR15MB1193;6:MMighRqGg7aqWjh3pD8BFQQSwgC6jVJVWGYsM6oONXGLGa80xj+NqaMnCS3KsEOMCsTEWDIQFva2pzJq8mD3QHRq9X2J4BTT2dKCgYGsYEAmOBEw40UH+hxwW/nKBlJ6sMgnNTKhaN6LhvgibinOqMU3x5ooWuZ90jr/ThfuNzEHU8VHVajvLMuYqbiSV77NC4CzGP9zyVcC4QFwnayZG/D+M8QZL+kg9jSei3CGiCjjHKJ2w4byF4fpkeBOeE9x2TyRl+EyIfvuk38atWjlP7acbZ+1rOnGNr+Xwc/JV/toSjFHsl20SO+BqTo9Davb;5:GIWljy8Age/uXlp80YNW+gfhRnIb9JIYS6Y5uxnu9X+rcE31C1YZGQATbOghnRrjbbk6ytGq4Oh6FXFBPL19P/xTTAJEh43Iq7jFSFhX7EtPLVtXHMh3LJh/e8DG5/BVBAJuKGH2x0pMGxKV308HRw==;24:ZHkW4Hin3nAMYmbpMgZyovXopgYNhljmg4+mdSifXPAgIuKLg+/eaC0F33IUoOkLtDzM1KOAONg5S2fpCaTwpYjSyvV26BEgtPKF1CVjeeQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM5PR15MB1193;7:yDZmqRgSWHbMFgXGELRJjFXFRBd12a4h2nt8wc6tcfInGqZ8miqogpDriDRKWxmRr0lHZ8YSkgxUrcNy6oL94MNB6/dHm4/crd+ZovOT9X9fuKZ+X16xKpalfGVT3XtwXF56Ui7E/VdRSqgZnN+CNvqLLZ5ALsGb7eKSi6KB+lKar0al7KOPxlWnogIrpD2e3Y9ie45T8o03t+wNJemWwqYLjDiM/AlPwuMKmHBzWp5HQJlAiszny6k68aSGMa18ptoLnhohv0etSY/uQvKl8h04KQoyK19Fm7AtEKYRT9YQunsefHeTvQ42ctP66f95OFyDVbvRAOf1caDnCJcxCbFHrgtIL7O9tIL9drF9mqQ=;20:ZdWl8D5ZaNhz1pPAKYzNiEE9GeedwS6sOnbgexh6z2osc+752a6DAct9SN+/blPTHdbIkpT1HJVMGHC4/7Svt1L0pZ97046atUov+7wmpenMHGBZlTa8+O2EORsQQV1tHUA7TX5PNt5LBOdS7NPQQLTowIkzZSLLn4WScjHX2hg= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2016 15:16:39.3421 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR15MB1193 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-08_05:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2609 Lines: 51 On 11/08/2016 06:42 AM, Jan Kara wrote: > On Tue 01-11-16 15:08:51, Jens Axboe wrote: >> Enable throttling of buffered writeback to make it a lot >> more smooth, and has way less impact on other system activity. >> Background writeback should be, by definition, background >> activity. The fact that we flush huge bundles of it at the time >> means that it potentially has heavy impacts on foreground workloads, >> which isn't ideal. We can't easily limit the sizes of writes that >> we do, since that would impact file system layout in the presence >> of delayed allocation. So just throttle back buffered writeback, >> unless someone is waiting for it. >> >> The algorithm for when to throttle takes its inspiration in the >> CoDel networking scheduling algorithm. Like CoDel, blk-wb monitors >> the minimum latencies of requests over a window of time. In that >> window of time, if the minimum latency of any request exceeds a >> given target, then a scale count is incremented and the queue depth >> is shrunk. The next monitoring window is shrunk accordingly. Unlike >> CoDel, if we hit a window that exhibits good behavior, then we >> simply increment the scale count and re-calculate the limits for that >> scale value. This prevents us from oscillating between a >> close-to-ideal value and max all the time, instead remaining in the >> windows where we get good behavior. >> >> Unlike CoDel, blk-wb allows the scale count to to negative. This >> happens if we primarily have writes going on. Unlike positive >> scale counts, this doesn't change the size of the monitoring window. >> When the heavy writers finish, blk-bw quickly snaps back to it's >> stable state of a zero scale count. >> >> The patch registers two sysfs entries. The first one, 'wb_window_usec', >> defines the window of monitoring. The second one, 'wb_lat_usec', >> sets the latency target for the window. It defaults to 2 msec for >> non-rotational storage, and 75 msec for rotational storage. Setting >> this value to '0' disables blk-wb. Generally, a user would not have >> to touch these settings. >> >> We don't enable WBT on devices that are managed with CFQ, and have >> a non-root block cgroup attached. If we have a proportional share setup >> on this particular disk, then the wbt throttling will interfere with >> that. We don't have a strong need for wbt for that case, since we will >> rely on CFQ doing that for us. > > Just one nit: Don't you miss wbt_exit() call for legacy block layer? I > don't see where that happens. Huh yes, good point, that must have been lost along the way. I'll readd it. -- Jens Axboe