Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp409758ybv; Thu, 13 Feb 2020 02:50:40 -0800 (PST) X-Google-Smtp-Source: APXvYqwc0GqqHhq+SqLaWjeNylC3+kuszwdUSEvPR89Jel4sqFAKkZrXZMNq2OKRTy6Y/q5N2zCT X-Received: by 2002:a9d:7653:: with SMTP id o19mr12408756otl.118.1581591040195; Thu, 13 Feb 2020 02:50:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581591040; cv=none; d=google.com; s=arc-20160816; b=rF5DjbRW7Vh5BbjmfnijApauxaXJhHMSW0jiK9HEFBqfzhpGTcPqM5gkYUDavybDKW mtDNU8EOCBsKR59NHdXzf+U+cVpiNtKO6Ho2AXm+cfdlTu/Aec159hSE0hlsyp2rRUXh KnSiivYykCzQXp9ZeMG00/IM5dBScHRT5BbF/IPli5a5kC/Ax7djsD2efwMjHx1sn7VG 6lcF3rX9mRnvpMgOhvoOn6lnIPvuIzE5TPmU0rJQkhBg4qbPRs07YOjav4K3Rk/KWxn3 xcGiGlFDkiz8Ks1ROGm3Oy6YvjHkSKuGISyQAvtqSEbb36UR3AM33J5f+0V4zP+Tx2si Lh9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=QrD5OPfoFXn8QK8sMnrpplPUoyRlVLixrfl0sxa4Fp8=; b=pOwCxuYWvWc+dAmOKk9lEq9+sGHuWr1xqDlyGc2fPlDfyiGBdQBDpSSXgpcNclA7BS 2hGHsEBFkf9Ibvi+NtrSaZmlvZGvvrml6mX+BtCxMAKrDYM6eirgGe4IRlDLO/lPgTFd CBOwuQzv1melJXTjBuPMXMKusX52vR3rdKX1XhL4kgcm2q3zt/JHlZxvKr6mLj6AZQNH gOytUr5x/3hfD8k2vikRdghJes4FZ9xfOUXHCh8fIj7cWkyWLNU5CHjtY++4TCep3E9d MU+jjKlq80O8KIXHzaVz0oAJI/3tWf8eqxrUcIaPc8Wsjiaa7tqIr5bqUNftBACxMtCs xp/Q== 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 v21si843404otj.282.2020.02.13.02.50.28; Thu, 13 Feb 2020 02:50:40 -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 S1729674AbgBMKtM (ORCPT + 99 others); Thu, 13 Feb 2020 05:49:12 -0500 Received: from foss.arm.com ([217.140.110.172]:44754 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729511AbgBMKtM (ORCPT ); Thu, 13 Feb 2020 05:49:12 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D91BB1FB; Thu, 13 Feb 2020 02:49:11 -0800 (PST) Received: from [10.1.195.43] (e107049-lin.cambridge.arm.com [10.1.195.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BD2BD3F6CF; Thu, 13 Feb 2020 02:49:10 -0800 (PST) Subject: Re: [RFC PATCH v4 4/6] sched/cpufreq: Introduce sugov_cpu_ramp_boost To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, rjw@rjwysocki.net, viresh.kumar@linaro.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, qperret@google.com, linux-pm@vger.kernel.org References: <20200122173538.1142069-1-douglas.raillard@arm.com> <20200122173538.1142069-5-douglas.raillard@arm.com> <20200210130802.GG14879@hirez.programming.kicks-ass.net> From: Douglas Raillard Organization: ARM Message-ID: <56c3a7c0-0d41-809d-6929-086d7a9251b9@arm.com> Date: Thu, 13 Feb 2020 10:49:09 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20200210130802.GG14879@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB-large Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/10/20 1:08 PM, Peter Zijlstra wrote: > On Wed, Jan 22, 2020 at 05:35:36PM +0000, Douglas RAILLARD wrote: > >> +static unsigned long sugov_cpu_ramp_boost_update(struct sugov_cpu *sg_cpu) >> +{ >> + struct rq *rq = cpu_rq(sg_cpu->cpu); >> + unsigned long util_est_enqueued; >> + unsigned long util_avg; >> + unsigned long boost = 0; >> + > > Should we NO-OP this function when !sched_feat(UTIL_EST) ? > >> + util_est_enqueued = READ_ONCE(rq->cfs.avg.util_est.enqueued); > > Otherwise you're reading garbage here, no? Most likely indeed. The boosting should be disabled in that case. > >> + util_avg = READ_ONCE(rq->cfs.avg.util_avg); >> + >> + /* >> + * Boost when util_avg becomes higher than the previous stable >> + * knowledge of the enqueued tasks' set util, which is CPU's >> + * util_est_enqueued. >> + * >> + * We try to spot changes in the workload itself, so we want to >> + * avoid the noise of tasks being enqueued/dequeued. To do that, >> + * we only trigger boosting when the "amount of work" enqueued >> + * is stable. >> + */ >> + if (util_est_enqueued == sg_cpu->util_est_enqueued && >> + util_avg >= sg_cpu->util_avg && >> + util_avg > util_est_enqueued) >> + boost = util_avg - util_est_enqueued; >> + >> + sg_cpu->util_est_enqueued = util_est_enqueued; >> + sg_cpu->util_avg = util_avg; >> + WRITE_ONCE(sg_cpu->ramp_boost, boost); >> + return boost; >> +}