Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2623360imb; Mon, 4 Mar 2019 09:42:33 -0800 (PST) X-Google-Smtp-Source: APXvYqzLfJ0HJrulldm8eHZjqZmUriFGt96Xojl5Q5SctoH9xqK05e/ma9P0TGCIVqH+PinJXP00 X-Received: by 2002:a63:ff1f:: with SMTP id k31mr19637882pgi.422.1551721353250; Mon, 04 Mar 2019 09:42:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551721353; cv=none; d=google.com; s=arc-20160816; b=c6ZhT/npygETAgglqxSq0mCzP8uZt9JaIgw+2/+wgMte3V67JfCt8XXsxQer8phMtE 44mroCfX5Dj4bpP7AiZAQdlGSRW2VYiCre340RxtVa1xA5EHfatU528zucq7xRodUFFe 41vacEnoykT9kZA8qqV2tHxH/ZjO51mgWrww+BlHPPlR6jezn9B1wxfvh1kX86TRZEsZ SSd7dBSx6UBjSZrsixmR6lSQcnNGVi1JChsVUs8rJm+r+0hoKkk3JyXg6OyQhjEERXf/ oevZdZSBT27MMoGyp6WAJDsDpWQtcVT3s1ye1Qo1vr3kX2x8KKCLEokWqUCu1Cg74fT1 stSg== 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:dkim-signature; bh=40I1v536/b41E6WOnWF6IY07esNf1kVynE6ckzDTCe4=; b=dXQ53JXq2AadUdC5gd7jk+CoVfJxaG6BHSkwOJDhmrN40zdSDL54oMGkwx+KZvuzWH Nhtr1eW7QFNzf/lN1+HjLU4kpkvgv9RZcJss/YxMHDBkzpu5WEf7xxQBq4ksyFbqWgJu ZDRavMdrPYBzd7dfhtmWqybiKBiEPzoOmhKUPm7ppXU1xdKUH+gsScClwWz5UWdVc6df DDEuqOLqmbP5auKdQK6PoGN9Ye2dYwlTkXAx347dSBOpldTS0fsJ+T9BuZA9oO1T8JVx /5hmOYlali1I01Yh4JhFUZ5ys1Ur8Td/q2PGW50LOrge9wYoGWElF2EMZZsCkU8CtPR+ RqbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=h2lvm4kV; 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 y16si5930321pll.83.2019.03.04.09.42.16; Mon, 04 Mar 2019 09:42:33 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=h2lvm4kV; 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 S1727424AbfCDRki (ORCPT + 99 others); Mon, 4 Mar 2019 12:40:38 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:48250 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727278AbfCDRki (ORCPT ); Mon, 4 Mar 2019 12:40:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=40I1v536/b41E6WOnWF6IY07esNf1kVynE6ckzDTCe4=; b=h2lvm4kVxd7o+Kbxp1w0Drrxj +DygUkgjo0VTEPI9+CmBrLNtRt5/88dNiPK9GxYlSSeKmyDJJaVSXxsdVYCukFN5NlUHaTNaQGl93 VcKB+121hnCrQWeoZGbE3KvEAeU4h8NQwjv3zrN0DBhCZPfvUKr6PJwbULj9kSwTLoNomta8SmuoK eYvA2g98sxXcVjwTUynPFpixmkBMnhpSsjZDZeJ9lhswllFd2zca87WjNRaKxSZ8hbd9EdlI9LE7j G+K1Uho4XfD9Q6fSXD0Wr2dycIBFN41N2mHYbqqJTOGGmqlDCvGKZ0oHBt0DJIDAzcylNRgLQ82QS lSw0od06g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h0rZm-0001Hi-Rg; Mon, 04 Mar 2019 17:40:31 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 53B752029319B; Mon, 4 Mar 2019 18:40:28 +0100 (CET) Date: Mon, 4 Mar 2019 18:40:28 +0100 From: Peter Zijlstra To: Quentin Perret 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: <20190304174028.GO32494@hirez.programming.kicks-ass.net> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190304164816.4fnxxesjwzdoqria@queper01-lin> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 04, 2019 at 04:48:16PM +0000, Quentin Perret wrote: > > @@ -837,7 +818,9 @@ static int sugov_start(struct cpufreq_policy *policy) > > memset(sg_cpu, 0, sizeof(*sg_cpu)); > > sg_cpu->cpu = cpu; > > sg_cpu->sg_policy = sg_policy; > > - sg_cpu->iowait_boost_max = policy->cpuinfo.max_freq; > > + sg_cpu->min = > > + (SCHED_CAPACITY_SCALE * policy->cpuinfo.min_freq) / > > + policy->cpuinfo.max_freq; > > The 'funny' thing is that on big little this 'min' can end up being > larger than 'max' ... > > On juno r0 for example, min_freq and max_freq for little CPUs are > respectively 450MHz and 850MHz. So you get sg_cpu->min=542, but > sg_cpu->max=446 ... So you'll max out after the first IO wakeup. > And since iowait_boost is reset whenever it is smaller than sg_cpu->min, > you end up with something that can either force max freq or apply no > boost at all ... > > 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. 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; - 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);