Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp861485imm; Fri, 1 Jun 2018 10:47:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKVBmFuPBNtobfBidwrYMZcdOpinIqGq4w6i1ZoEpkfusqE1iMHD4zQ/Y5gpnelXBLbtqlF X-Received: by 2002:a63:a042:: with SMTP id u2-v6mr9891753pgn.413.1527875251230; Fri, 01 Jun 2018 10:47:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527875251; cv=none; d=google.com; s=arc-20160816; b=md8TQgfH5Mupx/zoMeHPRrpFdIbj/oT0MwToNCrxLKnPJPP/3rz54UKV/x9idClrXF iGufvu4iwjgHIxWXSkYuYaijisJ7qIajt5BJ9DlSvPEUAiBWl/xJsaFRgTqchl+j0WT9 rLx0aC3VHCHZoH2RF9NC2te3rkMZX3/Jx+mPXqnMFuRn9+VGWhi7RJxN09FH30e6BENg gLs8EWRcBodF0CNk0zxOTK04dpSmSzvr0NzDf5cxKJCzbumOL8k64xTEFu9sh8hClalx 07g7Qk5bgC0fsNTIcd2ORITOg3fCVx5TOc3eQNO8YymANZZKyJBDr9b4qRvrGUOmk2Ck 4udw== 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:dkim-signature:arc-authentication-results; bh=dhSt/F4gGdpsoc1zTHO/k8mZ3+8FmR7qy0I0dyzcZ9o=; b=1EzFGKVNaFSBZxj0d3ECXf8X5qZrBisif9m+wIVQVu20NohC4YViDeChVzK/IzRj/D PyIdStBBmLQ86CRyKYq2Bur1Up7fVLyNcx02jMM8ei15TVxzPf6AHDjKKSX2A2K/jrvP jWc6RjLwBNFeWWtyn+gNNvgO4ELoxW/JUbBEwGvxuNdA3iIzT957ZdnNJM/sTKA6PNzI xV2Zl/36MJld/TO73cXuLhLDZjtD0UaHVNRwfOuoghml1OvlVGpLKO2RX9vMEAKmS7hj XlxdvAIzLWFVv69LdBsuqdNpj3Lnz/CtSrWj2ZPekU4xPBma65kXCkEuNU2WsW6lEuXw G1MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aUAeq2eh; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w16-v6si40275962plq.141.2018.06.01.10.47.16; Fri, 01 Jun 2018 10:47:31 -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=@google.com header.s=20161025 header.b=aUAeq2eh; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753150AbeFARpe (ORCPT + 99 others); Fri, 1 Jun 2018 13:45:34 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34218 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753063AbeFARp3 (ORCPT ); Fri, 1 Jun 2018 13:45:29 -0400 Received: by mail-pf0-f194.google.com with SMTP id a14-v6so12847229pfi.1 for ; Fri, 01 Jun 2018 10:45:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dhSt/F4gGdpsoc1zTHO/k8mZ3+8FmR7qy0I0dyzcZ9o=; b=aUAeq2ehNCiqr6qVD6SLith01buZNPca2Gc0TS4uDhgDMfOC+WypEOROu/bFFcUHNJ LVBaBrvLpEN4d/gkNJtLtb8XkW5tk7tq0AHAn6xIXubBRRQ6TdKht3cQ9yHhajoWJkjl UMvyzBbByihpSV6tqvB1xiBV8wUWbFR3nqif0l9PiROVJHkYI7vi9+JeoEX6WpxH1Oph hN/i5Y/8dw53AwnRF0yRHm5jxUq5aGp2yZ+SeW2Oe47y0+/9VZf5LGUujT+cYfbZLfV3 23Ybc5ceUPwqYg392Y1j+PVIqzdSyKV04f2QJKFa0emWqJDixSx8VfyK6ww2oYv4jkyK WCgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=dhSt/F4gGdpsoc1zTHO/k8mZ3+8FmR7qy0I0dyzcZ9o=; b=D4dQB/akU5VA3SThXpM6QDeYuPyUcYAa8PdGNYPlWtRtKLMZUxLEnrj7FqwJbnAGdl 1ky/YteZkWXKqbxIAUXmSzzQ840UhIb1jfFEOTG35v1BZS3+Paj91dWZiFrtjwEyebed i7Yn0gahLrwX+YIQQypgimXPKROGWZ3e369uUfJfq/d1zPJ4/hSPya7dTac9M2RXB/xQ skna4odBJGGOJ0GUFh92GXIXFNgrG1Gobfpc/QaAAyL705i3Iy6rxxI9MX6EupyFd0Xi pntKKvFXlgNdoaZENTYQicU5xGIbJf5YOnxm47QUB1YOhohMRTqT2CMMZPudFYgz6NS6 093Q== X-Gm-Message-State: ALKqPwfrFUdT/fJf0D50YQ3P3yiQFKULzkHzd4DJJi9DCXpS2tEokzRc NvwBuNU/GR0PDmk1YQQE6YkHPQ== X-Received: by 2002:a65:4888:: with SMTP id n8-v6mr3671753pgs.251.1527875128292; Fri, 01 Jun 2018 10:45:28 -0700 (PDT) Received: from localhost ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id g8-v6sm58527702pgc.0.2018.06.01.10.45.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Jun 2018 10:45:27 -0700 (PDT) Date: Fri, 1 Jun 2018 10:45:26 -0700 From: Joel Fernandes To: Vincent Guittot Cc: Juri Lelli , Patrick Bellasi , 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 , kernel-team@android.com, Alessio Balsini Subject: Re: [PATCH v5 05/10] cpufreq/schedutil: get max utilization Message-ID: <20180601174526.GA105687@joelaf.mtv.corp.google.com> 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> <20180601135307.GA28550@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180601135307.GA28550@linaro.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 01, 2018 at 03:53:07PM +0200, Vincent Guittot wrote: > > >> >> 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 > > > The code below adds the tracking of the waiting level of cfs tasks because of > rt/dl preemption. This waiting time can then be used when selecting an OPP > instead of the dl util_avg which could become higher than dl bandwidth with > "long" runtime > > We need only one new call for the 1st cfs task that is enqueued to get these additional metrics > the call to arch_scale_cpu_capacity() can be removed once the later will be > taken into account when computing the load (which scales only with freq > currently) > > For rt task, we must keep to take into account util_avg to have an idea of the > rt level on the cpu which is given by the badnwodth for dl > > --- > kernel/sched/fair.c | 27 +++++++++++++++++++++++++++ > kernel/sched/pelt.c | 8 ++++++-- > kernel/sched/sched.h | 4 +++- > 3 files changed, 36 insertions(+), 3 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index eac1f9a..1682ea7 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -5148,6 +5148,30 @@ static inline void hrtick_update(struct rq *rq) > } > #endif > > +static inline void update_cfs_wait_util_avg(struct rq *rq) > +{ > + /* > + * If cfs is already enqueued, we don't have anything to do because > + * we already updated the non waiting time > + */ > + if (rq->cfs.h_nr_running) > + return; > + > + /* > + * If rt is running, we update the non wait time before increasing > + * cfs.h_nr_running) > + */ > + if (rq->curr->sched_class == &rt_sched_class) > + update_rt_rq_load_avg(rq_clock_task(rq), rq, 1); > + > + /* > + * If dl is running, we update the non time before increasing > + * cfs.h_nr_running) > + */ > + if (rq->curr->sched_class == &dl_sched_class) > + update_dl_rq_load_avg(rq_clock_task(rq), rq, 1); > +} > + Please correct me if I'm wrong but the CFS preemption-decay happens in set_next_entity -> update_load_avg when the CFS task is scheduled again after the preemption. Then can we not fix this issue by doing our UTIL_EST magic from set_next_entity? But yeah probably we need to be careful with overhead.. IMO I feel its overkill to account dl_avg when we already have DL's running bandwidth we can use. I understand it may be too instanenous, but perhaps we can fix CFS's problems within CFS itself and not have to do this kind of extra external accounting ? I also feel its better if we don't have to call update_{rt,dl}_rq_load_avg from within CFS class as being done above. thanks, - Joel