Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756228AbcK1XLD (ORCPT ); Mon, 28 Nov 2016 18:11:03 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:43825 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756216AbcK1XKg (ORCPT ); Mon, 28 Nov 2016 18:10:36 -0500 Date: Mon, 28 Nov 2016 15:10:18 -0800 From: Shaohua Li To: Tejun Heo CC: , , , , Subject: Re: [PATCH V4 10/15] blk-throttle: add a simple idle detection Message-ID: <20161128231017.GA99394@shli-mbp.local> References: <20161123214619.GE11306@mtj.duckdns.org> <20161124011517.GC4724@ksenks-mbp.dhcp.thefacebook.com> <20161128222148.GB12948@htj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20161128222148.GB12948@htj.duckdns.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-Originating-IP: [2620:10d:c090:200::1:e0c] X-ClientProxiedBy: BY1PR18CA0017.namprd18.prod.outlook.com (10.162.126.27) To BN6PR15MB1633.namprd15.prod.outlook.com (10.175.129.23) X-MS-Office365-Filtering-Correlation-Id: 09150c88-98b7-4784-9848-08d417e3be4a X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN6PR15MB1633; X-Microsoft-Exchange-Diagnostics: 1;BN6PR15MB1633;3:UxQohFzuBAmVcES1FuPEKN9HMUrBCyEEwPIkQtT+hPD4aDnnxyuI0YN2mJ3766BEm7bbfwS1qcP37VOK7NcfBqWg4SXcpuhF3hVoNWVgtQ2eOYNb5d1Xm3VF43U16ei7LYWXeUf76MGHaGuSg486g3sZHVU8x4A+YPkNAOTdLELHOGbwtITEQlJ9qozPzckp5rlBKxpQZIdlQgzn/AQ3IbcNjtViEvTGMOmTCw6ojhHBlZDHt1CZLTipXzfTG/X+cXMCyYcT9MOmEkHOYawxkQ== X-Micros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6/Z85QLzz0M6rPjBKN6JgMd3gP8oVryI3poK1Xu7fFsVLTfht3WxbZLaguq8SmvRg==;20:ODcsLpMgk2mq0xqcXKT4oE0Oztz6wk5GNQoOcYftTQwfBymlwDjHqtqpwFKq89NiJSD69Edtdc9cWsKJ4PLrDrAinQDIxYc6fuCrWmQzDMaPYAZoO+w4nt4CdnZNQ52/o3t8Ze6sM4chp3OpdoNUWU6qv99t7xtL/ycvNoZMbWKZ7dm6rmGKxJsMagTUF64XikMCExlJq5HjtcfferBioRIr4D8wrrXscOirEEjddg9Odana/WVeAQyNLuOFHSZ4 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6060326)(6040361)(6045199)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041248)(6061324)(20161123555025)(20161123564025)(20161123562025)(20161123560025);SRVR:BN6PR15MB1633;BCL:0;PCL:0;RULEID:;SRVR:BN6PR15MB1633; X-Microsoft-Exchange-Diagnostics: 1;BN6PR15MB1633;4:gzpr3uO1hTR4D+Z7bUEN77wcX3KKfkFo5GegPQtutLITOfGkGZm49wFgG22kCLUI/ydl7LOoZM1M6UseErkp3poRbOFlPYZxM5B+0x5A2/R3u8+52IgsBp8um9B/loZyKrOT6us7+KwcV5PuNdJJxZ5AXW+MrYv2BOg3O7owbSna9D65R8179NyO+ZCRfHcXs7t5zOXFdqhbKzGTN5h67648ADGW/uGoFprcI8VNhWaS2kyWGcncUlKEIHRgQgl1XaFbrhcb+UJnansPAolIkLOBFObUu3+IT01NGHBRXsgT8B1iGCEtSxNCGSIuNMzmotmPnwIej6pS71YcRXmi2yk5FFR+dsgflUGF1KuUvFzlqwGBVDc9DM2WbAQl6RZSywC1+GAD4VoqvntEUc6eHtDZIeJD0uhQEtWRl9oiwN73S8DuASp2Sv5wjIuafuwnZVbGzEDiZnOZRTePtbUk7bOn91pvh+hoqXswUPXO21h1Mm4GntLGZix+f87aHQPF4HuhGFX5rIzP3vsDcceX/xWIMqArVgDnVv+ZSoD6edfv3KxmAOjO8ENIaKMU03Eh74+KswnXGtU4IrOB6unwNSlcm2NBaWbEUYEmGV60h3U= X-Forefront-PRVS: 01401330D1 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(24454002)(189002)(50466002)(2950100002)(2906002)(86362001)(50986999)(6666003)(33656002)(6916009)(7736002)(76176999)(5660300001)(110136003)(305945005)(97736004)(83506001)(4001350100001)(105586002)(68736007)(7846002)(101416001)(4326007)(23726003)(106356001)(6116002)(97756001)(1076002)(54356999)(47776003)(9686002)(92566002)(229853002)(42186005)(189998001)(38730400001)(8676002)(98436002)(81156014)(93886004)(81166006)(39400400001)(39410400001)(39450400002)(733004)(46406003)(39380400001)(18370500001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR15MB1633;H:shli-mbp.local;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN6PR15MB1633;23:cGX9J7acANasEWbw03tp5gqnCMzWHyxHCidvcO/D+?= =?us-ascii?Q?e7SAaNjk7EsVZGE7vz9nyZDGQsyyjDGeqWMyFp0Llf/sfHfvRup3rnWkaiZ2?= =?us-ascii?Q?HUnuX44oZkn3OVEz4Q/3yWaITmO9vkrPZ8/0XOH067dN5EQzP172jCOGOTS8?= =?us-ascii?Q?AN43pfQ/fZ4wE/6uBt2X2v9P3WDEZwryKWyeNiS1bu8xcxF68QGCS9Jmbtiw?= =?us-ascii?Q?H9/ZKtjkGjX2Ym7JUzrBwWDVhNcDZS6VwtrHldVzB9V0TbNjBal1JkSAFzpi?= =?us-ascii?Q?KwOwOgMsPVz8DOVADuUscQrlIzVgMKFXazYYJ8D2z5CPHZIHl0Lh7hZYbQeI?= =?us-ascii?Q?Pziv+/lgpfEcR58NJML/NWy32AtTlyY/AXDz7YwA2dCSNnfgToJwZqusA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nJ4EitX5pNiPeUCUR1aqWjRFRi9+mXNEvnlsD1Wjt9jhUtvW6phVNZ1LsqNz/60OzW+imMJjfoZ+YJ+4i8g2Ddn4bi4sr+b5zsTAHn3qPdzJI9X+Cx/oNBp0zv5r9QM01lQcCV3AAoyoF38lByE/UF3HlgLdffczsE5OyQQrCLvkhvDqx63q2i7noQKvG5ICD+9IhSyVknZmdOhEjkC76ALGxJ5mHdLx17uTnVd6FN2f76o/CBnJxnN2ifrcut/kYovkurmodTvKBw==;20:DlJUSjsTs9HI06wQWcxUDvZJCS62q61d5pwqL6dJkqsFxxNBi/kzkISsHNZHe2Z67NqBKQY+IOzfz/xDCrcxY4mdzLvZ5iHziIeNpdWg6bhLiOh3KP6RTxUJ/8YHdvL86QmWJaRUBmVNhAYHYGTfV+5k95NntYONb/rXFnCCq3M= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2016 23:10:27.5420 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR15MB1633 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-28_17:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3174 Lines: 58 On Mon, Nov 28, 2016 at 05:21:48PM -0500, Tejun Heo wrote: > Hello, Shaohua. > > On Wed, Nov 23, 2016 at 05:15:18PM -0800, Shaohua Li wrote: > > > Hmm... I'm not sure thinktime is the best measure here. Think time is > > > used by cfq mainly to tell the likely future behavior of a workload so > > > that cfq can take speculative actions on the prediction. However, > > > given that the implemented high limit behavior tries to provide a > > > certain level of latency target, using the predictive thinktime to > > > regulate behavior might lead to too unpredictable behaviors. > > > > Latency just reflects one side of the IO. Latency and think time haven't any > > relationship. For example, a cgroup dispatching 1 IO per second can still have > > high latency. If we only take latency account, we will think the cgroup is > > busy, which is not justified. > > Yes, the two are indepndent metrics; however, whether a cgroup is > considered idle or not affects whether blk-throttle will adhere to the > latency target or not. Thinktime is a magic number which can be good > but whose behavior can be very difficult to predict from outside the > black box. What I was trying to say was that putting in thinktime > here can greatly weaken the configured latency target in unobvious > ways. > > > > Moreover, I don't see why we need to bother with predictions anyway. > > > cfq needed it but I don't think that's the case for blk-throtl. It > > > can just provide idle threshold where a cgroup which hasn't issued an > > > IO over that threshold is considered idle. That'd be a lot easier to > > > understand and configure from userland while providing a good enough > > > mechanism to prevent idle cgroups from clamping down utilization for > > > too long. > > > > We could do this, but it will only work for very idle workload, eg, the > > workload is completely idle. If workload dispatches IO sporadically, this will > > likely not work. The average think time is more precise for predication. > > But we can increase sharing by upping the target latency. That should > be the main knob - if low, the user wants stricter service guarantee > at the cost of lower overall utilization; if high, the workload can > deal with higher latency and the system can achieve higher overall > utilization. I think the idle detection should be an extra mechanism > which can be used to ignore cgroup-disk combinations which are staying > idle for a long time. Yes, we can increase target latency to increase sharing. But latency and think time are different. In the example I mentioned earlier, we must increase the latency target very big to increase sharing even the cgroup just sends 1 IO per second. Don't think this's what users want. In a summary, we can't only use latency to determine if cgroups could dispatch more IO. Currently the think time idle detection is an extra mechanism to ignore cgroup limit. So we currently we only ignore cgroup limit when think time is big or latency is small. This does make the behavior a little bit difficult to predict, eg, not respect latency target sometimes, but this is necessary to have better sharing. Thanks, Shaohua