Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2681023imb; Mon, 4 Mar 2019 11:13:41 -0800 (PST) X-Google-Smtp-Source: APXvYqyh0lux0BUNx+bxYlpR1JrqxM1rbS/OeqMeFMQfPiGS3Z5MGE3g6WdRPpbVRc5nAlwVGs9Z X-Received: by 2002:a17:902:9683:: with SMTP id n3mr22197318plp.333.1551726821275; Mon, 04 Mar 2019 11:13:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551726821; cv=none; d=google.com; s=arc-20160816; b=Sk0KlkIuq6ZdGKw9aojVB9zE7jIiUXzBXAnBA3i8LjG+PiSzWLZdNd7wGY35ENQ4Or LgeJS5WOqQ5saVV8Vqxh1D66DTIHgCGUY7ziDeSfjZ3I5CwhgwSnaxpx0WGJK/iYC8mO M0fDZOsfzjw9ebT/ZYfYXrL6Xk7jUvN/pQMPuSyJzEtAJjJ0LHI4R847QPitDtXnZvFx XN6pKSuVuhdR0769aKO4+oVF27yFdtPh6D5gwvLV9PP9w6PUKsfdabsu1j+yGRNq114Y qdwwsdEDoee5iLHQv5IsO1WWLoSMC3+V8pQqRc5OQkTXvv8w1nUP9ft/nXbe3oMPxK7w mVtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=jbiFWqbJOt1q4FGKzSvb7rinBLnSYX9OvjjacMofQlY=; b=HK74ZkICJQl9K93K1JhUMUIyCSxMi9iB+eIvOAQl0N3tLnyHepT30bXeIn8ZsPmU4k aXO1BIUSYmSi2QkJ/P7LrfQZGljvlyAGPajfmCjGzvPyd/RkMjks6OraxhjXXlvM8VlH Ljlpv2vQyp5cjU1h3msnkSgCsuTCg7zN2b3NhSbKKptd+jPqGKSK8XLzeyiuTKwDfAEl Nf5kRNceYcz3StyBR6sCNU4ZggNv4WWkd+wK2Bf20MtpFTCotzi5n49nfu3CGWWPXFkI jlTF0NUZS/zynoBsyWlbdKH3lG2fTg0jIUU9wQmt/FnQ5X2gqjcvnRrVuNewuUbD8iy6 x3Pw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si5387385plf.186.2019.03.04.11.13.25; Mon, 04 Mar 2019 11:13:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727256AbfCDTLJ (ORCPT + 99 others); Mon, 4 Mar 2019 14:11:09 -0500 Received: from foss.arm.com ([217.140.101.70]:38754 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726180AbfCDTLI (ORCPT ); Mon, 4 Mar 2019 14:11:08 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EF77CA78; Mon, 4 Mar 2019 11:11:07 -0800 (PST) Received: from queper01-lin (queper01-lin.cambridge.arm.com [10.1.195.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 980233F703; Mon, 4 Mar 2019 11:11:06 -0800 (PST) Date: Mon, 4 Mar 2019 19:11:01 +0000 From: Quentin Perret To: Peter Zijlstra Cc: =?utf-8?B?V2FuZywgVmluY2VudCAo546L5LqJKQ==?= , =?utf-8?B?WmhhbmcsIENodW55YW4gKOW8oOaYpeiJsyk=?= , Ingo Molnar , "linux-kernel@vger.kernel.org" , Chunyan Zhang , "Rafael J. Wysocki" Subject: Re: =?utf-8?B?562U5aSNOiBbUEFUQ0ggVjRdIHNj?= =?utf-8?Q?hed=2Fcpufreq=3A_initializ?= =?utf-8?Q?e?= iowait_boost_max and iowait_boost with cpu capacity Message-ID: <20190304191059.mzwid3udqwtzejww@queper01-lin> References: <1550831866-32749-1-git-send-email-chunyan.zhang@unisoc.com> <20190222105957.wxhlcmoag5f3i4fi@queper01-lin> <9099990618e242e1bab77ce3f9d9b1e3@BJMBX02.spreadtrum.com> <20190304135810.rq2ojnbn5vezrab3@queper01-lin> <20190304152616.GM32494@hirez.programming.kicks-ass.net> <20190304164816.4fnxxesjwzdoqria@queper01-lin> <20190304174028.GO32494@hirez.programming.kicks-ass.net> <20190304175030.4slf247y2eftkmu4@queper01-lin> <20190304184708.GQ32494@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190304184708.GQ32494@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday 04 Mar 2019 at 19:47:08 (+0100), Peter Zijlstra wrote: > On Mon, Mar 04, 2019 at 05:50:32PM +0000, Quentin Perret wrote: > > On Monday 04 Mar 2019 at 18:40:28 (+0100), Peter Zijlstra wrote: > > > > Perhaps you could keep the 'util' and 'max' pointers in > > > > sugov_iowait_apply() and overwrite them like before, but in the > > > > SCHED_CAPACITY_SCALE scale as you suggest ? > > > > > > Urgh; but then we're back to having that boostrap problem. > > > > Hmm, I don't understand :/ > > Yeah, I seen to have reading comprehension issues today. Ignore that. > > > > Now; at this time; @max is in fact scale_cpu_capacity, so can't we > > > change this: > > > > > > - /* > > > - * Apply the current boost value: a CPU is boosted only if its current > > > - * utilization is smaller then the current IO boost level. > > > - */ > > > - boost_util = sg_cpu->iowait_boost; > > > - boost_max = sg_cpu->iowait_boost_max; > > > > I was basically suggesting to do 'boost_max = 1024;' here and you > > should be good with you way of computing 'min' no ? > > Right, but then we keep having to retain those two mults. > > > > - if (*util * boost_max < *max * boost_util) { > > > - *util = boost_util; > > > - *max = boost_max; > > > - } > > > + sg_cpu->iowait_boost_pending = false; > > > + > > > + return min(max(util, sg_cpu->iowait_boost), max); > > > } > > > > > > to something like: > > > > > > /* > > > * @util is already in capacity scale, convert iowait_boost > > > * into the same scale so we can compare. > > > */ > > > boost = (sg_cpu->iowait_boost * max) >> SCHED_CAPACITY_SHIFT; > > > util = max(boost, util); > > > return min(util, max); > > > > > > > But this should work too, I think. > > While that is only a single mult. Yes, and that's also easier to understand (IMO) because all the requests going to get_next_freq() are in the scale_cpu_capacity range, which keeps things consistent regardless of the iowait stuff. So yeah, that works for me. Thanks, Quentin