Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2654507imb; Mon, 4 Mar 2019 10:31:06 -0800 (PST) X-Google-Smtp-Source: APXvYqwB+WNA1LvspIU28HdTiRdutHgywTo49H+4PwcXuEV2gwpwQv7FGA0s1aaLOTWROQ2h1148 X-Received: by 2002:a17:902:290b:: with SMTP id g11mr21699954plb.269.1551724266805; Mon, 04 Mar 2019 10:31:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551724266; cv=none; d=google.com; s=arc-20160816; b=smlIoLUp/8A7GONsZKkpBNOos9kERZzQD/gwdMatPaswUZBmGlpXLasXZa6ZlqWvBJ hYA/1EAR+grbWJfuiBqbOShcf/Z4q5KlF1veoxNjFdbA/3EeJj1GkSfS9jCYhYBlEo9E EGmVAhjEf+VmKQWxZ1FfThRyVi/3tNGioojxb9/KY5qAJB/OrTsviOIq3w911Rz9IPoX WDVhUDDR7hI6oynxawHocjkKWrjmhwv7ZMn3NyyPIvsICSng6pgtlRJna9fHv5DQ5K7P VxKS20S0rUJufWhmcA6GCMvZpwREFf2aA3oAtHHFT2Gf1xtP4rwv/ciSmtO3/Za1nD6Y Uy0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=S6awRhQ5D2b8C+QX/fFUFZuvqk6WDzLKAcqRIT41rUs=; b=lXFAH/xRqVNby6cPmzMXuH1zn6xAqGVaerYbNkdp9ZByFvUfI4gYeNn3ExSiTy1QmC Zka1tHeC8wRii4MH2mUHoJ8P4e4/ljO0rb8uc8avalP2oL8BclS8Gnt0eyZEimdtUAgk lMwdd2c+6MefYFrLiPp61iio6891wnr08eWe7OcKWlpXdJjtpo9Qnu15b4Fz81D64Pf1 eo51TWYWKOp5p0FmKK0rLVGYIQLiBj8U0faZ25mrhg5NsslPksIF434ci+tGlEVhnQV/ a86iUAAuOSg8FsvbF+2DQ/MnnK201FH1gJ3k1ui2EOzG5Gg7ulA2qAt9LUzks0KLf1k+ usOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bT87HitP; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p65si5885853pfa.27.2019.03.04.10.30.51; Mon, 04 Mar 2019 10:31:06 -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=pass header.i=@linaro.org header.s=google header.b=bT87HitP; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727451AbfCDRlL (ORCPT + 99 others); Mon, 4 Mar 2019 12:41:11 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:39894 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727421AbfCDRlK (ORCPT ); Mon, 4 Mar 2019 12:41:10 -0500 Received: by mail-lj1-f194.google.com with SMTP id g80so5067413ljg.6 for ; Mon, 04 Mar 2019 09:41:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=S6awRhQ5D2b8C+QX/fFUFZuvqk6WDzLKAcqRIT41rUs=; b=bT87HitPxDBdLAXvuIqFsNUqqjfxdI/TVOQco68zvJTHMrZHY+Xsd+w6nnhewwPA75 DIw7h3HoeK4M+hyuBz4Q8SgwfZbTBASvn+V5vFaMeRSQPE40HGg2icpNKmS36Eb99IrY aKPuEceBA3E45MoQfdzr0icCM5I4TZ24uTUm0t7Co2QeCabpp7pJv+VPodfi0e4tp7kE 2XaFDPAEoY3ymzSK/q0ZFQlT48FsYi40X0vUIR1tjfcPBZTLha27mAt6cUPHDxsayG2z 9+MKIIyVOwYVS0p4TjavZJNc/w9wtvhWqEUcQjKPYMwgbMe37xpUkXObKrWj+xH+YuMg oHAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=S6awRhQ5D2b8C+QX/fFUFZuvqk6WDzLKAcqRIT41rUs=; b=OJZ34OD3WhVi8K9HT9Rmn4v02nSRoB2SkhOJVS8Vmb73zwS7XxkAJg+rILt0fbWgge 8Dua5Q5xUwzdPVAjn49OFbCWrBHPo5ig5W95uhK7nR7bSujrL2v41OB8qd8Z/c/Pk0RW qCATleS7LqLJ7Gt7IkzrRh+MAeZA3Gk18waMLR9gmq/JyX3q3Cwvp7/u17lb3GMBy3oG nvYSGo3MMdFPeVfQUi6+vOlcEie/JeVsKUj/9NVZ7ofX6SWYb1bEB8oFs4U1RE7nH1sc nqAXmV3L9oRGNc1sxUEzDJYzKRsqS8ZgGpMGdoLxbuLrqjMMI8CDhUqd6fkqG6sUImZy G6qA== X-Gm-Message-State: APjAAAXVKB7cI3CEPjlrWSdQkNhRXg8yFzOR2k3Z05yPbLdHNq7PUu1N 8KBqprcn5GfQUeegNLN2HJXg15k9E2nD3FssgD/g1w== X-Received: by 2002:a2e:80cd:: with SMTP id r13mr11081006ljg.34.1551721267690; Mon, 04 Mar 2019 09:41:07 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: <20190304164816.4fnxxesjwzdoqria@queper01-lin> From: Vincent Guittot Date: Mon, 4 Mar 2019 18:40:56 +0100 Message-ID: Subject: =?UTF-8?Q?Re=3A_=E7=AD=94=E5=A4=8D=3A_=5BPATCH_V4=5D_sched=2Fcpufreq=3A_initialize_iow?= =?UTF-8?Q?ait=5Fboost=5Fmax_and_iowait=5Fboost_with_cpu_capacity?= To: Quentin Perret Cc: Peter Zijlstra , =?UTF-8?B?V2FuZywgVmluY2VudCAo546L5LqJKQ==?= , =?UTF-8?B?WmhhbmcsIENodW55YW4gKOW8oOaYpeiJsyk=?= , Ingo Molnar , "linux-kernel@vger.kernel.org" , Chunyan Zhang , "Rafael J. Wysocki" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 4 Mar 2019 at 17:48, Quentin Perret wrote: > > 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' ... yes arch_scale_cpu_capacity() should be used instead of SCHED_CAPACITY_SCALE to be compared with sg_cpu->max and sg_cpu->util > > 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