Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp583806imm; Thu, 31 May 2018 06:03:15 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLsBkJ2/SygQeTC+Mw88A49xZfIG3wWqZoxoQLxDFwk98UfoLe5/plfKIT4nBpopNz0LGzL X-Received: by 2002:a63:b64f:: with SMTP id v15-v6mr5399312pgt.276.1527771795334; Thu, 31 May 2018 06:03:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527771795; cv=none; d=google.com; s=arc-20160816; b=q30oAsUzJ7QrXIa1nJeK6x+tfJjnPJNNHFSs8X/AmW5IDJXKOGFZkCmvlC/qEh2dXF FeSGF5m/wHVwHX55oU1oyw7ogIsd0+1ad3jFCSho3KwiRrHNlehYuXrftgcQzPXqTKfO L05zND6PD/2WM8fMsXqyalMFNZ2jEiY4Ium+rsqSqDYZa/DmPbgmeRTlpSnF3s6/BZfQ t6vGfPJrRLzr0AL7zLpzpDbW3IddoRUvezeDIROVhLDPgkYiZ7yPUAL1l6fi9zBkHhhj liWZfhCxitAjkA9plQVdvoflt3AGQeGHhilHd/XoV8PzAlzFvx4tSd6grYOKRw7+Hqks UcNA== 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=Uy4Cc59+XS0+PDD23HOu55v86LtdZe6Pko19F1PK7tk=; b=UNkRFJctV6DF7buXKoUKcrESuk1bvIRqYpcS8cuOChV7VUvqTFzkRe2iI8J9l3nEgM U/olrUXvhEmWNPwbraS36zv2QwO9uRlU5UVHNyL7WkKvy5MruEKFEhVt69g2h0Dk5Wye 9FOlTuaqLuS9X/qBEwRzdeMyeRJKs40aK4o/cP1pRYXW8ZEssM/tdtS7vEcEayYarlN/ wkzPc6W0kptJx7PSuT//X/ECfBAVPL1QiEYY58opI2ESdjfObz5LaWuLLFcWNlVEQYwx XCWvH2que/vSqz8v5NZR1P+54MKzPY2WElxG5D2X9QXxpJvX0+KumqKc0sPVfD0AYm9F DJpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gQK3J3VG; 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 c2-v6si37274240plb.77.2018.05.31.06.02.55; Thu, 31 May 2018 06:03:15 -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=gQK3J3VG; 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 S1755036AbeEaNC1 (ORCPT + 99 others); Thu, 31 May 2018 09:02:27 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:37048 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754867AbeEaNCZ (ORCPT ); Thu, 31 May 2018 09:02:25 -0400 Received: by mail-io0-f196.google.com with SMTP id e20-v6so25662034iof.4 for ; Thu, 31 May 2018 06:02:25 -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=Uy4Cc59+XS0+PDD23HOu55v86LtdZe6Pko19F1PK7tk=; b=gQK3J3VGeAxtj0aBuqIuIsBLD8ff4AczXvKx4qnj5KybNhWPRr3o0DlFzsy1BpFrc6 rEoahk7zP0Qfha1oay5sX82NGV4elUvRUE1veEBJVDVAkxO0iRsxrvcq6hN52bDW6MKR BlnwJ66+Sd2w/BgUiVm/ZUQz22Jjihw+h19gY= 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=Uy4Cc59+XS0+PDD23HOu55v86LtdZe6Pko19F1PK7tk=; b=LqpyivJ75ybY408Ggg3lz2WpX5/QdCsyMlTdfcq9vv6gp7GuBOdhCWUrnwXA/lKeNF 1GE7bpD1A1fRd93R9Ty8BPxykMZfzuCiB5JYbmDmv6LPEPRm4xwe0+VVoT8BWGFVFRcJ hqAHcyj/3nPPJGeY2wqbBSi8GLo4dopuq7/HIPJNVCTyss25vUzOZRSWoNCmzFQrgGf2 8I/a0Mlyk87md6aw1vo3RPbNPp18jHl6+LVORokZma7usFdZcXY6zexdfV/wT90lokvA CeR4+UEClD496b+5J4g42xeRCn1L4Ih6Eo1H7Ov+c39t4zp7yPRV1RoZKP+q4YI2CJe/ 5mMw== X-Gm-Message-State: ALKqPwfdgAoBI4QdWyuGlaBYuROfwQslzW6pSNWCDs4QvfgpW4ICnbn/ ZjtFh7u8CQdTojry1OMIrr9odi1xGAQfxx7/+TyIxg== X-Received: by 2002:a6b:e315:: with SMTP id u21-v6mr6723155ioc.196.1527771744996; Thu, 31 May 2018 06:02:24 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:4cc:0:0:0:0:0 with HTTP; Thu, 31 May 2018 06:02:04 -0700 (PDT) In-Reply-To: <20180531102735.GM30654@e110439-lin> 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> <20180528152243.GD1293@localhost.localdomain> <20180531102735.GM30654@e110439-lin> From: Vincent Guittot Date: Thu, 31 May 2018 15:02:04 +0200 Message-ID: Subject: Re: [PATCH v5 05/10] cpufreq/schedutil: get max utilization To: Patrick Bellasi Cc: Juri Lelli , 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 On 31 May 2018 at 12:27, Patrick Bellasi wrote: > > Hi Vincent, Juri, > > On 28-May 18:34, Vincent Guittot wrote: >> On 28 May 2018 at 17:22, Juri Lelli wrote: >> > On 28/05/18 16:57, Vincent Guittot wrote: >> >> 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. > > With UTIL_EST enabled I don't expect an OPP reduction below the > expected utilization of a CFS task. I'm not sure to fully catch what you mean but all tests that I ran, are using util_est (which is enable by default if i'm not wrong). So all OPP drops that have been observed, were with util_est > > IOW, when a periodic CFS task is preempted by a DL one, what we use > for OPP selection once the DL task is over is still the estimated > utilization for the CFS task itself. Thus, schedutil will eventually > (since we have quite conservative down scaling thresholds) go down to > the right OPP to serve that task. > >> >> The example with a RT task described in the cover letter can be >> >> run with a DL task and will give similar results. > > In the cover letter you says: > > A rt-app use case which creates an always running cfs thread and a > rt threads that wakes up periodically with both threads pinned on > same CPU, show lot of frequency switches of the CPU whereas the CPU > never goes idles during the test. > > I would say that's a quite specific corner case where your always > running CFS task has never accumulated a util_est sample. > > Do we really have these cases in real systems? My example is voluntary an extreme one because it's easier to highlight the problem > > Otherwise, it seems to me that we are trying to solve quite specific > corner cases by adding a not negligible level of "complexity". By complexity, do you mean : Taking into account the number cfs running task to choose between rq->dl.running_bw and avg_dl.util_avg I'm preparing a patchset that will provide the cfs waiting time in addition to dl/rt util_avg for almost no additional cost. I will try to sent the proposal later today > > Moreover, I also have the impression that we can fix these > use-cases by: > > - improving the way we accumulate samples in util_est > i.e. by discarding preemption time > > - maybe by improving the utilization aggregation in schedutil to > better understand DL requirements > i.e. a 10% utilization with a 100ms running time is way different > then the same utilization with a 1ms running time > > > -- > #include > > Patrick Bellasi