Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932302AbcK2Xjt (ORCPT ); Tue, 29 Nov 2016 18:39:49 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:41543 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755101AbcK2Xjk (ORCPT ); Tue, 29 Nov 2016 18:39:40 -0500 Date: Tue, 29 Nov 2016 15:39:24 -0800 From: Shaohua Li To: Tejun Heo CC: , , , , Subject: Re: [PATCH V4 15/15] blk-throttle: add latency target support Message-ID: <20161129233922.GA67472@shli-mbp.local> References: <420a0f26dd7a20ad8316258c81cb64043134bc86.1479161136.git.shli@fb.com> <20161129173108.GB22330@htj.duckdns.org> <20161129181403.GA36738@shli-mbp.local> <20161129225446.GC17732@htj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20161129225446.GC17732@htj.duckdns.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-Originating-IP: [2620:10d:c090:200::3:9efb] X-ClientProxiedBy: CY1PR17CA0034.namprd17.prod.outlook.com (10.163.68.44) To MWHPR15MB1647.namprd15.prod.outlook.com (10.175.138.151) X-MS-Office365-Filtering-Correlation-Id: 6368605a-48c9-4b55-fc04-08d418b0f8cb X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR15MB1647; X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1647;3:8KFvDel5mFYwlEWFxjBOdr42rrI3H1MlIplB+KHlEIRML4Bk9dI6tlwoGjDYb3x6BJLUdCKHh7Qno0FYb03ca4TG07gnaK7tu5eyif3RBXq+gJ68vP1w0emuIZbZVTIbP7Emv77M6iHIWbw/u6JmsotsxFpwVF98R4qqdfd6+MmaiF4ituAAh/rPunwHdA8YSdcZYsQ7TEjZjzC+GhhYN7ePWROwZ6W/KtmCNgqCdDKIEyn0tEbgQfnc3kgbY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RVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041248)(20161123564025)(20161123562025)(20161123555025)(20161123558021)(20161123560025)(6072148);SRVR:MWHPR15MB1647;BCL:0;PCL:0;RULEID:;SRVR:MWHPR15MB1647; X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1647;4:k4yrvwvHEAnVhpzQeCy0OKk/sGgiwAtQJAuH/47JdJZTvFCKldURRHHIadtHC72CaIhkT7rumRWpt81lrI0ufvbwcl9gvYTAHozFjEBH5DPwJ7PytdlYA0mBg7IggEJ/X9EFpmOcJc3mEhH2jLIpkvzuK6FzJrCn6y6ggJovlSyKY2TlZNgUw1Km2xR6dIFlT7Dx9tO6c3qgP2Ao/gJKjMMQD+SYY6b///7zoawfp8OZk5JuVEfQnHV+WXw+dyXZjO01noKGENJufeUE4wFr24GiMnyAj5yHfHruxr/DyH/C/EGs84Cyg8FV7mcu+gPSs5BmItzsAcHpll5FomQc+AmuJPIf+PqOtavuEaxc+G78JQXJE2q38Y2myBMAhmYArkAXrPDwofNmubDsdz9pLvcQ2Pmjj47GlphPL8LadNyjhgih/XOFn6LoiY2wjmwa4K1VXQ+FVFhrluBl9Yo3a78p1T6jY3EhrUSfeitDSGYmp5cbnaMJpXTl2M6Y+IHPXoQdtt7AJ3IFXwH/qNWDn8z/j0RIa7rPswosUhgQTLA6wg5kk6VbZw4bOEFzNtGguEBhdp8YVOyUfaptIgPuXkPrB3Pwp+TnO4yJ7SrxLMA= X-Forefront-PRVS: 01415BB535 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(51444003)(24454002)(86362001)(54356999)(50986999)(76176999)(42186005)(50466002)(47776003)(97756001)(46406003)(6116002)(97736004)(189998001)(23726003)(1076002)(68736007)(81156014)(8676002)(81166006)(9686002)(4326007)(5660300001)(4001350100001)(2950100002)(2906002)(110136003)(6916009)(33656002)(98436002)(6666003)(7846002)(7736002)(305945005)(106356001)(105586002)(93886004)(101416001)(92566002)(39410400001)(39450400002)(733004)(38730400001)(229853002)(83506001)(18370500001);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR15MB1647;H:shli-mbp.local;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWHPR15MB1647;23:mf5FZtUOPMs0163qkQL1dUmODQhndRAMSr6PCeK8d?= =?us-ascii?Q?kp/sDLjHwM8WIkn+GJsN8a4LcdG2WxDfr5KP41U5yiQt2tdXcfSj1LmCi7Vm?= =?us-ascii?Q?0L2fykRxOJrPGG49Jo8jrsh903AG47YHiDP/UaARfzv12hBrynLgGIWmj/i6?= =?us-ascii?Q?d6HkHSKKIK8OyhmeOpv3r9RnfHf3kGgYzO1kn0gV1DNy6gYwqM/o8CxAARTd?= =?us-ascii?Q?yGbnuNFgqrQNxICyOMqWGHxJSMRVO85na5J9JC4zK9ryzf+R7IDM3Qs8GDAG?= =?us-ascii?Q?wRjua6AJRcuArMgRBK2Icb6Q4zVyr8ux3+jNVNjBIKFBDtHEKPzHJksxprLI?= =?us-ascii?Q?XQPv2t5CiLk2Qz4IzxdG/oEExDqyF38mZclwgmvMw0T5ijNxyIznMnya1Bny?= =?us-ascii?Q?2JUr6N3eX2aMRamZCtUchRw3cUBBdofLCRjdz9N95vcU8Mx/YalVC0FrnPVV?= =?us-ascii?Q?fKwrvh9QS2SD5BB1pknCMXwwd7lLysYqANQkL3QKabsNbOwPWPOEtpdiT2UD?= =?us-ascii?Q?ofZZWuv18zBJro/RWllNodGibU8Zf+P/EaJ9M6tm9j04qWLr69Ly3gVGhQNU?= =?us-ascii?Q?SMIVp+bSaTZKIs0vUkR73xGDpO5+IjvmhyKIe6biBIh2QQRHv+jU4djF0SMY?= =?us-ascii?Q?Y9Gf5oaTxx8n78sq0Gh+Wq/Hh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cxTRyYi14Cc4KwaOsEnkcZWYfmZo+ispmzEh+gXnoZ67hqM2SK+44worfQv7oWw/BrAgv7vAgIcsQ2p6mRAM= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2016 23:39:32.7436 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1647 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-29_08:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3815 Lines: 82 On Tue, Nov 29, 2016 at 05:54:46PM -0500, Tejun Heo wrote: > Hello, > > On Tue, Nov 29, 2016 at 10:14:03AM -0800, Shaohua Li wrote: > > What the patches do doesn't conflict what you are talking about. We need a way > > to detect if cgroups are idle or active. I think the problem is how to define > > 'active' and 'idle'. We must quantify the state. We could use: > > 1. plain idle detection > > 2. think time idle detection > > > > 1 is a subset of 2. Both need a knob to specify the time. 2 is more generic. > > Probably the function name 'throtl_tg_is_idle' is misleading. It really means > > 'the cgroup's high limit can be ignored, other cgorups can dispatch more IO' > > Yeah, both work towards about the same goal. I feel a bit icky about > using thinktime as it seems more complicated than called for here. > > > > > static bool throtl_tg_is_idle(struct throtl_grp *tg) > > > > { > > > > - /* cgroup is idle if average think time is more than threshold */ > > > > - return ktime_get_ns() - tg->last_finish_time > > > > > + /* > > > > + * cgroup is idle if: > > > > + * 1. average think time is higher than threshold > > > > + * 2. average request size is small and average latency is higher > > > ^ > > > lower, right? > > oh, yes > > > > > > + * than target > > > > + */ > > > > > > So, this looks like too much magic to me. How would one configure for > > > a workload which may issue small IOs, say, every few seconds but > > > requries low latency? > > > > configure the think time threshold to several seconds and configure the latency > > target, it should do the job. > > Sure, with a high enough number, it'd do the same thing but it's a > fuzzy number which can be difficult to tell from user's point of view. > Implementation-wise, this isn't a huge difference but I'm worried that > this can fall into the trap of "this isn't doing what I'm expecing it > to" - "try to nudge that number a bit" situation. > > If we have latency target and a dumb idle setting. Each's role is > clear - latency target determines the guarantee that we want to give > to that cgroup and accordingly how much utilization we're willing to > sacrifice for that, and idle period to ignore the cgroup if it's idle > for a relatively long term. The distinction between the two knobs is > fairly clear. > > With thinktime, the roles of each knob seem more muddled in that > thinktime would be a knob which can also be used to fine-tune > not-too-active sharing. The dumb idle or think time idle is about implementation choice. Let me take this way. Defien a knob called 'idle_time'. In the first implementation, we implement the knob as dump idle. Later we implement it as think time idle. Would this make you feel better? Or just using the new name 'idle_time' alreay makes you happy? For dump idle, we probably can't let user configure the 'idle_time' too small though. > Most of our differences might be coming from where we assign > importance. I think that if a cgroup wants to have latency target, it > should be the primary parameter and followed as strictly and clearly > as possible even if that means lower overall utilization. If a cgroup > issues IOs sporadically and thinktime can increase utilization > (compared to dumb idle detection), that means that the cgroup wouldn't > be getting the target latency that it configured. If such situation > is acceptable, wouldn't it make sense to lower the target latency > instead? lowering the target latency doesn't really help. In a giving latency target, cgroup can dispatch 1 IO per second or 1000 IO per second. The reality is if application stops dispatching IO (idle) and if application's IO latency is high haven't any relationship. Thanks, Shaohua