Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2645048imb; Mon, 4 Mar 2019 10:15:13 -0800 (PST) X-Google-Smtp-Source: APXvYqw9YmOKAjM9KnhQ92VqWgwML/MPfPXdABtBAzxgGR3u9kzwcDaemNs2xgRgS7oH6kPbe/al X-Received: by 2002:a63:2808:: with SMTP id o8mr19734577pgo.188.1551723313536; Mon, 04 Mar 2019 10:15:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551723313; cv=none; d=google.com; s=arc-20160816; b=wVuE3vWRJhMQgsfbtjogtMKe1ysygd/+2El0tes5fVcZ+oBZkUuITApA7b0wyg17qh oB645RwEVY2WPm0xaVb0h0uTwyyV7Gz0WraUNBv9LN85iMXNqR8vSSLbuuttJEj54egd wSSuIwrleJuRyxE4Id6QMr6p3Lb1V8h9C8cM+tMsryq21inwLnC4Hszejs7ptcAhxSpr 6FdwI6M36IvIeo7UDyhzRDSEaay5Sc/3BI6X0+DPVt0xAHSZqK/7DMZWGH1j+XAfkZ/i /Po5jxovXWUQ6OokrY6Nieb9YnerrRqfvH3jF8AbrbGi/p2+P27ju2Md8C527hthUAN1 VrCw== 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=2NKzV3tQGrfEGyl1Haa08hUlY+um6PdmClgzdj/9jqw=; b=w/JvH0VHsUqIhEgPqumzPB7grnJevYjCi5lo/GgpE9piM11OglqpYKrBqHkshuPuv1 qTuHgjrtlpF2qzMHnpd6k6dpeqTprCcDkfxhQEV5LGC/6VBubeQyWm81szHsDAd6SKSd /rB5kgSeoAL96MJRrfzfu0RzF057Swq4UJYv6+I84UKyRETq5/W8r1IK0ox8m2cKwJsg n6Q1oeEhpSkjtzaru+1TRwmoWL77XDZ6RblgvPne81smvNS0BJ7rUddlA8E2uFYdveFV bpzF/Q3Z5U4h+5F5uOLT4sowxVSMmG8JTS8kUUF6FH0lY0tVmS/YX4IVioJf6+U0NzpZ IcEQ== 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 v4si5698409pff.172.2019.03.04.10.14.58; Mon, 04 Mar 2019 10:15:13 -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 S1726995AbfCDQsU (ORCPT + 99 others); Mon, 4 Mar 2019 11:48:20 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:35984 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726063AbfCDQsT (ORCPT ); Mon, 4 Mar 2019 11:48:19 -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 487B0A78; Mon, 4 Mar 2019 08:48:19 -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 E45CF3F703; Mon, 4 Mar 2019 08:48:17 -0800 (PST) Date: Mon, 4 Mar 2019 16:48:16 +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: <20190304164816.4fnxxesjwzdoqria@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190304152616.GM32494@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 16:26:16 (+0100), Peter Zijlstra wrote: > On Mon, Mar 04, 2019 at 01:58:12PM +0000, Quentin Perret wrote: > > You could also update the values in sugov_get_util() at the cost of a > > small overhead to compute 'min'. I'm not sure what's preferable since > > we wanted to avoid that kind of overhead in the first place ... > > Or,... we could actually make things simpler. > > How's the below? I have a feq questions wrt min, mostly: > > - what's the difference between policy->min and > policy->cpuinfo.min_freq; it used to be the former, the below uses > the latter. As mentioned on IRC, IIRC policy->min is something that can be written from userspace (for example) to cap the min freq. OTOH, cpuinfo.min_freq is read-only and just reports the lowest OPP. Rafael is this correct ? > - should we have a min_freq based value, instead of a constant; the > difference being that with this the actual boost speed depends in the > gap between min/max. If the above is correct, then I agree. Looking at min_freq simplifies things quite a bit since it doesn't need to be updated all the time, and the whole policy->min stuff is dealt with at the CPUFreq core level so it's not obvious sugov should care. > Anyway; the below converts iowait_boost to capacity scale (from kHz), it > side-steps the whole issue you guys are bickering about by limiting it > to SCHED_CAPACITY_SCALE (aka. 1024) on the boost path, and then limiting > it to @max by the time we figured out we ought to use it. > > And since that means we never change @max anymore; we can simplify whole > return value thing. [...] > @@ -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 ? Thanks, Quentin