Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2436140imm; Mon, 28 May 2018 08:04:11 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqkQQ3YDNymf1o0N2oGPihjn6a843ed5JgQ0ikQOAjkSHpTx+/oxtKciitSGhrv2uGno1fJ X-Received: by 2002:a17:902:850a:: with SMTP id bj10-v6mr13717834plb.239.1527519851193; Mon, 28 May 2018 08:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527519851; cv=none; d=google.com; s=arc-20160816; b=aSEnnKXeKggtPm2K8mZ1R/BxruBUcNxbGyqK0QNQFWmn/UVfLBIw9xnXIJCmA9GDGx hLbEsLpHWvY0HRrCyn8yFfhVSeLrzXTfUfW/MKd9mgTXslnWqix8+K6O+sZ6i7nPM04S YL1oRQHeJYzelrPugSpd15eI9wTPTvN3PKEM3lllTZnolKw/Via/v4tEX5RST84CZTxw cGctfWoN4D4ITDe0ddwLP3FMcT5dK1H1LCaMzb9m4uD4MJu3TEyJZjYRl5/xEJ8JoAId bwZIl4hfKqbMjBCTMbWP6YOhCwemsAN5A+x8P4Fydmpg/Ei7t8qo3PkHMxz5s7l1tjhM QPkw== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=dc/ZB1T/H7GzFCOkNsQMqyWcX/JeG2OS6ZMrvDIVUMw=; b=i/7upznrxkMNtYIAhZ8RbMITspduv66XoHN5kfQuQ+aNi1okL75Wc+eFlZJ4HSDY1E zb9Wf9qEHHxHYSsjXzYE5n62KERt63FYyWcfpWEnBNlVNKNxZg+eNvtktnZAeMWaLbA3 lw6o40iiHtnaicSuTKSbdiac27pxIiU4GwGTSrY8DTkjEyfyom+tmP9B7n7DZfjdj3cu BbesDsQ98mh/k38L/NKBFrqq4vI4HV7sWB5xDRbacI/LT1G4weP2bYeX9lsc+5DlvR3W zLDrdhHRpUu/uu7hlkJWXJ6qVf+O6clLWjKMX9yYT0G9mLcRZ9ri9aLk+wC0gJGwi9zz 3xWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QClniHsU; 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 l81-v6si31224265pfj.127.2018.05.28.08.03.56; Mon, 28 May 2018 08:04:11 -0700 (PDT) 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=QClniHsU; 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 S937006AbeE1PDJ (ORCPT + 99 others); Mon, 28 May 2018 11:03:09 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:44509 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937150AbeE1O5z (ORCPT ); Mon, 28 May 2018 10:57:55 -0400 Received: by mail-io0-f193.google.com with SMTP id y2-v6so9017972iob.11 for ; Mon, 28 May 2018 07:57:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=dc/ZB1T/H7GzFCOkNsQMqyWcX/JeG2OS6ZMrvDIVUMw=; b=QClniHsU0C+se55/Jzb/v7XC+lrC15oj3ymqwZoeqiQm1hHYJ9ASM0ylfpO2ptZQ8S SXa20KM0h1AVQQI7xObwXnLEUtBD2AI4iQhwtDcLZrVpgupeMkX/+gEXTAqr3qXN1HzI g1OKCnkTl59jCxg3tYLd24c8SuL+DvFTQXjo4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=dc/ZB1T/H7GzFCOkNsQMqyWcX/JeG2OS6ZMrvDIVUMw=; b=fMhjcLZjDfU1bxgNVJT3wmr2xkAEbPgfQcLNppjJtzp9cHLMNx0rjnCy9sdefHhCul 8g/D/xaBVKVEAYGibOmOE0zk4vR/+ArHD+O7o2Ittvd+RAaj7hyBSZqmMjrMDLIfFQsy fIzfY7LXHbuvZc1ylaDCPA7TUFhZpZwQQEtTLYCbuXfYqvqSraYpQsRiKwjVggr1++DM 84NaSfR2Lki7rYcHyfP+U3xKGkiWNXquBB8/tEfXVMWzOmtEKEzQOIC+yHdHosuCv5XL vhJTJfoZQr8Az8R2z/oiJoaIx27uJJ0ElimsjtkZQ7CTzwWb04w1fiGVMx/dczPvdfjr IJRw== X-Gm-Message-State: ALKqPweOhn5YEt1nYQLdcjIIW1AsnyAw52M/RuPuzIZSPojd3tJGLjNK hNj/Taly1wxjAWf6WEqhLjeZTep6cNY3kv/0rxaSdw== X-Received: by 2002:a6b:c88c:: with SMTP id y134-v6mr1154837iof.295.1527519474858; Mon, 28 May 2018 07:57:54 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:4cc:0:0:0:0:0 with HTTP; Mon, 28 May 2018 07:57:34 -0700 (PDT) In-Reply-To: <20180528101234.GA1293@localhost.localdomain> References: <1527253951-22709-1-git-send-email-vincent.guittot@linaro.org> <1527253951-22709-6-git-send-email-vincent.guittot@linaro.org> <20180528101234.GA1293@localhost.localdomain> From: Vincent Guittot Date: Mon, 28 May 2018 16:57:34 +0200 Message-ID: Subject: Re: [PATCH v5 05/10] cpufreq/schedutil: get max utilization To: Juri Lelli Cc: Peter Zijlstra , Ingo Molnar , linux-kernel , "Rafael J. Wysocki" , Dietmar Eggemann , Morten Rasmussen , viresh kumar , Valentin Schneider , Quentin Perret , Luca Abeni , Claudio Scordino , Joel Fernandes , Alessio Balsini 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 Hi Juri, On 28 May 2018 at 12:12, Juri Lelli wrote: > Hi Vincent, > > On 25/05/18 15:12, Vincent Guittot wrote: >> Now that we have both the dl class bandwidth requirement and the dl class >> utilization, we can use the max of the 2 values when agregating the >> utilization of the CPU. >> >> Signed-off-by: Vincent Guittot >> --- >> kernel/sched/sched.h | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h >> index 4526ba6..0eb07a8 100644 >> --- a/kernel/sched/sched.h >> +++ b/kernel/sched/sched.h >> @@ -2194,7 +2194,11 @@ static inline void cpufreq_update_util(struct rq *rq, unsigned int flags) {} >> #ifdef CONFIG_CPU_FREQ_GOV_SCHEDUTIL >> static inline unsigned long cpu_util_dl(struct rq *rq) >> { >> - return (rq->dl.running_bw * SCHED_CAPACITY_SCALE) >> BW_SHIFT; >> + unsigned long util = (rq->dl.running_bw * SCHED_CAPACITY_SCALE) >> BW_SHIFT; > > I'd be tempted to say the we actually want to cap to this one above > instead of using the max (as you are proposing below) or the > (theoretical) power reduction benefits of using DEADLINE for certain > tasks might vanish. The problem that I'm facing is that the sched_entity bandwidth is removed after the 0-lag time and the rq->dl.running_bw goes back to zero but if the DL task has preempted a CFS task, the utilization of the CFS task will be lower than reality and schedutil will set a lower OPP whereas the CPU is always running. The example with a RT task described in the cover letter can be run with a DL task and will give similar results. avg_dl.util_avg tracks the utilization of the rq seen by the scheduler whereas rq->dl.running_bw gives the minimum to match DL requirement. > >> + >> + util = max_t(unsigned long, util, READ_ONCE(rq->avg_dl.util_avg)); >> + >> + return util; > > Anyway, just a quick thought. I guess we should experiment with this a > bit. Now, I don't unfortunately have a Arm platform at hand for testing. > Claudio, Luca (now Cc-ed), would you be able to fire some tests with > this change? > > Oh, adding Joel and Alessio as well that experimented with DEADLINE > lately. > > Thanks, > > - Juri