Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933364AbcKVXI6 (ORCPT ); Tue, 22 Nov 2016 18:08:58 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:59318 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932231AbcKVXIz (ORCPT ); Tue, 22 Nov 2016 18:08:55 -0500 Date: Tue, 22 Nov 2016 15:08:36 -0800 From: Shaohua Li To: Tejun Heo CC: , , , , Subject: Re: [PATCH V4 02/15] blk-throttle: add .high interface Message-ID: <20161122230836.GA14628@shli-mbp.local> References: <239e20c62e028b570f48403faea1419c4d84f2bd.1479161136.git.shli@fb.com> <20161122200253.GA17534@htj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20161122200253.GA17534@htj.duckdns.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-Originating-IP: [2620:10d:c090:200::a:890d] X-ClientProxiedBy: BY2PR06CA0063.namprd06.prod.outlook.com (10.166.106.159) To BN6PR15MB1634.namprd15.prod.outlook.com (10.175.131.8) X-Microsoft-Exchange-Diagnostics: 1;BN6PR15MB1634;2:E7+4XoGp+UHI3ij+Xo0Vb/X/QJQ9oUhpl2hns5yukynAopEVMpEyDi84owCB0/Qtm8yS6DxzEpgrYEWRRvshCAGzATfDz2cf0NqWlj7vvE0IDyTqO2QOk7XXQG79xFQ0uhRjW7gKqZjFze+dd4oM5O79bnnNNtz04DDGkYGV3dU=;3:rO3ttpNzl8ZroxHFri7lLuOhU8WzKEw1PLdygWv4jcg1wH3lSdHdfqwfglJLQt4yqDCXm/6zmXD/E6Ta14g7sRKoqVGiaRe58Ml38P4JVWADu/oAnGGWN7UXU6DCHAvySPdN5y+w4Gd2+xwhmhqz3n8CVy/bD5coJPRju61lLbg= X-MS-Office365-Filtering-Correlation-Id: 36d436b9-67ee-4186-8a56-08d4132c82ef X-Microsoft-Antispam: UriSc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uAiT4f8O+zjGwn12S6PBCbN5q+FzbohzY+Ia+h53cLksSVOzaJY78tnwggXLy8wOSLKRRXbifgh+bkbMJ5D;20:upe6AwfRPrvUS+Er/+xkD9DTsR7vD2q4NTgAooOTi5Vq+SUO3O94lDWenTWt2B9IYV/njgtuxrDzR0kCyyiT9MMxRqnSATw7udxLLIqj0jaMYk+fKcFNb3FX1BMR2pjgL1tHw94aItUBqjx8vpsFw8XFLQ4QibWM9fcGZ3DPLOmieXkY1sqTgDJw8MS3l3mrLp58h0VOF5FQGUMBu91ohjHT0NMn7otaEHKngheTTBE3B4POohrRnCerNlONubeL X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6045199)(6040307)(6060326)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041248)(6061324)(6072148);SRVR:BN6PR15MB1634;BCL:0;PCL:0;RULEID:;SRVR:BN6PR15MB1634; X-Microsoft-Exchange-Diagnostics: 1;BN6PR15MB1634;4:OxG4E64ElmGok4xQAo0B/0sXcgcdTcFrGXiZ/8FKv3SGUmnKBMZnJ+9Y0cjuHsT0eZaLI1PnvJP0nTAociNQINWxnciLBnHCKUDGDLvXyAxIVR2NHtND18SIIeFP3XYk7bjjM1gpKQ5uJItrFgSKHWcpmKmI7Gr48Qd33ArTDPAO5Yg+DJgndUr9M+2NW9147pweO+oIjCzI/Amy78E3+2Hnh/sSv3s6WvubYu7WCwqMiStnOFfEXEDHmzuUn/j/B1okyrfWQ2IIio2VhkCwW8+O/xzM4X8BCw3vkd9eWN5XvogIpVYHo2tD956iNmXCVHa+3uzY4slukzY6YrjGVwLNyD5D5iTOOOoRTyUPohBiyXKYrf1cf4jqPKrRxFunaXfWzbH/oRtp6+aXfjt7gq+eo9E+VIZK1zc+Qq+4VXKo0owIKi6u+Ul5bP6b8nOaqP2WYjHG/bi8pvkpWB5/GtokIlIB7UMb7X0TEZbDreNZrgExMhHi5SQnon97iZ9y X-Forefront-PRVS: 0134AD334F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(189002)(24454002)(199003)(5660300001)(92566002)(97736004)(2906002)(189998001)(7846002)(83506001)(6116002)(7736002)(4326007)(77096005)(110136003)(305945005)(23726003)(4001350100001)(68736007)(86362001)(46406003)(98436002)(97756001)(1076002)(47776003)(33656002)(101416001)(229853002)(42186005)(9686002)(54356999)(38730400001)(50986999)(81166006)(81156014)(6916009)(8676002)(76176999)(2950100002)(106356001)(50466002)(105586002)(6666003)(18370500001)(142923001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR15MB1634;H:shli-mbp.local;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN6PR15MB1634;23:r3TMArrL/j6hIUDwAQP4FtUiQ3C5d8C1eHIrvbYav?= =?us-ascii?Q?y5cN2fMzTmxjAU18mCfeGffNdPoyMMR2ST1LMxwbs49qW2a/jN4qmtBmjncQ?= =?us-ascii?Q?n4tlrTo+bZZLDovN7/80CpI+jXdBZxQRtr4ihDYnX6vCZ/OdPMi1lyS4bgK6?= =?us-ascii?Q?GtA9hH3hLst9cM3Fe94y7MIAINRoSBE20iG1liwrDGjKJacaF83db2Nhp14Z?= =?us-ascii?Q?f1YgN1khxNHUcHUkx8G6n0hZC1tEh/3uQADUIk6cAkHHZ8nmgaxdX3jCJN6F?= =?us-ascii?Q?3U/izd5B2uiCyr+JWxitMgmGHw4piSi1g2rJKLWXIF8FWPJifCr4MNUdVh1c?= =?us-ascii?Q?b2wGpUmMH04s8AuuTIw0e17NV6EgBCgsJIH+p303oGf5ad/I7AV7D7MMOb05?= =?us-ascii?Q?mNh51i0DllJ7ukinGyWYhbzHlCFPR/dVMbdlqLQDiragxwh+lDOVH4EvjUSo?= =?us-ascii?Q?ptw+vkIKcFr86D/eTqhKrjBW9mRY5EvihrPpJY5ctz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c= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2016 23:08:45.3470 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR15MB1634 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-22_11:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2708 Lines: 73 On Tue, Nov 22, 2016 at 03:02:53PM -0500, Tejun Heo wrote: > Hello, Shaohua. > > Sorry about the delay. > > On Mon, Nov 14, 2016 at 02:22:09PM -0800, Shaohua Li wrote: > > @@ -1376,11 +1414,37 @@ static ssize_t tg_set_max(struct kernfs_open_file *of, > > goto out_finish; > > } > > > > - tg->bps[READ][LIMIT_MAX] = v[0]; > > - tg->bps[WRITE][LIMIT_MAX] = v[1]; > > - tg->iops[READ][LIMIT_MAX] = v[2]; > > - tg->iops[WRITE][LIMIT_MAX] = v[3]; > > - > > + if (index == LIMIT_MAX) { > > + if ((v[0] < tg->bps[READ][LIMIT_HIGH] && > > + tg->bps[READ][LIMIT_HIGH] != -1) || > > + (v[1] < tg->bps[WRITE][LIMIT_HIGH] && > > + tg->bps[WRITE][LIMIT_HIGH] != -1) || > > + (v[2] < tg->iops[READ][LIMIT_HIGH] && > > + tg->iops[READ][LIMIT_HIGH] != -1) || > > + (v[3] < tg->iops[WRITE][LIMIT_HIGH] && > > + tg->iops[WRITE][LIMIT_HIGH] != -1)) { > > + ret = -EINVAL; > > + goto out_finish; > > Is this necessary? memcg doesn't put restrictions on input but just > enforces whatever is configured. I think it'd be better to follow the > same model here too. Hmm... is this because throtl will be able to > choose either all high or max limits per cgroup? Thanks for your time! Yep, the limit could be high or max. It's doable moving the restrictions on input, but will increase trouble using the limits. If high is bigger than max, can I set high to max? if not, I'd prefer to keep the restrictions. > And this isn't from your patches but can we please switch to > UINT64_MAX instead of -1? Sure, will fix this. > > + } > > + } else if (index == LIMIT_HIGH) { > > + if ((v[0] > tg->bps[READ][LIMIT_MAX] && v[0] != -1) || > > + (v[1] > tg->bps[WRITE][LIMIT_MAX] && v[1] != -1) || > > + (v[2] > tg->iops[READ][LIMIT_MAX] && v[2] != -1) || > > + (v[3] > tg->iops[WRITE][LIMIT_MAX] && v[3] != -1)) { > > Ditto here. > > > @@ -1412,6 +1484,7 @@ static struct blkcg_policy blkcg_policy_throtl = { > > .pd_alloc_fn = throtl_pd_alloc, > > .pd_init_fn = throtl_pd_init, > > .pd_online_fn = throtl_pd_online, > > + .pd_offline_fn = throtl_pd_offline, > > .pd_free_fn = throtl_pd_free, > > }; > > I haven't read the whole thing yet but this looks a bit suspicious. A > css going offline indicates that the destruction of the css started. > I don't get why that'd reset high limits. There can be a lot of async > IOs after offline. Ok. We do want to reset the limits. Because if no cgroup has high limit, we definitively should use max limit for all cgroups. The whole state machine (switching between high and max limit) is meaningless in that case. Is pd_free_fn a good place to guarantee anyc IOs finish? Thanks, Shaohua