Received: by 10.192.165.156 with SMTP id m28csp375645imm; Wed, 11 Apr 2018 00:03:17 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+e0xa63YZMatae86Nh1z14XQ9XhoAsT9gBWLo/aKDmNoT5Jp3u8hLKaFJT75cCcqb9jMRJ X-Received: by 2002:a17:902:887:: with SMTP id 7-v6mr3792082pll.319.1523430197940; Wed, 11 Apr 2018 00:03:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523430197; cv=none; d=google.com; s=arc-20160816; b=mEUEtu3pCRH2EiXCEW5/QWkWY/NjXP3Q8NBmEeQj1+ZMeOD4jCKv0j5lmOAEGosRC7 WmYOoDsi3rH/bxQPzsFgTuorrhMk7V1/XwwvKwJa1lB6KY/08k3ZKdUf+pdbe5Tr/qNa 4RhqRM+sHAWTQTvLxty6bXgvctMRhCh0LJIo10z2+YXErJNVhheUTnJXFQsgOiMR5xqz iWWR0IBYdK9mLc7ENMiUVTy85D13nEq98K1oRtUbSMTWQOn9794unkqCdtM9fxKW01mi UkTtD4qF0XxO5LdxLSoJUIrCioJ5Lhv1KZH5cBz+kGNGRDjcAF5j/six/9SikA4695My 6f9Q== 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=6wRdPQZkRzMm8QaBarBB0sLyukQ9rwBOuA4tpq+VM84=; b=hR0uwusIi2XIxyL389XXos3nUE1A6ph+3tEjknpGgyr58ZvVVTyuxeyusVyLpDAJ4T gl45GCyUl3E8djHuABmPUImba1Iyt89nv2vWB4PxEFlI508+AysMdFfjDSWdAR+MQPvO jzoNKxd68h0Poh/6ZCN1oYNDVWNd9c3FW/8nLQCxSfbRRdptT+Kfae5wXmf8rz7Z4/Xw sh99aljLCa+6+6OrnO9qVKwDeQWxY0fyTJJ8PfkM4hoQeEPOYzw5ZupbTtNUm8JZpc35 X2OaHWq7Cg0xGYqZeDeFxfEGZZhedUrZPPPmvMqQWsQgjWbDUrFyjUnoxPqMYy7q0Wv+ OT6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZfA74fSb; 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 b96-v6si493469pli.407.2018.04.11.00.02.41; Wed, 11 Apr 2018 00:03:17 -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=ZfA74fSb; 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 S1752758AbeDKG6A (ORCPT + 99 others); Wed, 11 Apr 2018 02:58:00 -0400 Received: from mail-io0-f176.google.com ([209.85.223.176]:37441 "EHLO mail-io0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752588AbeDKG5y (ORCPT ); Wed, 11 Apr 2018 02:57:54 -0400 Received: by mail-io0-f176.google.com with SMTP id y128so1229294iod.4 for ; Tue, 10 Apr 2018 23:57:53 -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=6wRdPQZkRzMm8QaBarBB0sLyukQ9rwBOuA4tpq+VM84=; b=ZfA74fSbaEuNH7GDUSWBIhOgill8zPAd+v0nPhUA0ac+ehhCASG71UTG5NmsJQ4T7+ X/BUT2LEiVUPTQrJnpBlaguNYjnoC9Icw/gHSxhVIWf9Yq6cdFJblco4l8oMIQ6oNLfy WiZqVZBhEe2gqcRZ7kecpviunboWpLEByNOtA= 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=6wRdPQZkRzMm8QaBarBB0sLyukQ9rwBOuA4tpq+VM84=; b=ik7LTGR1FD4QeN+Hsqvh0VkHbsglF8PhV1ABl3GO2/+Nvdi+jnAZagoRjtCpgaXzjx rgeOT93C+cguUXE/t5S/Ez3irun/DZygvC0ROQpXo1BsGz9E0Pz+VdL7VmbyjYjZ6Psl OPyKaZj0hu0nKQhR+yskUZPJ6Pu1z0P3ohhK88F/7WkvbG56mlywSYSlACsPYDOgMsWZ VboIhHygy2f1IClGjFplylNqTtQa9KpwLexssC6QRSCpATQG2I9Lp+JVtjxGj4rwsPl6 PlCLKEUSVQDzL/q8JbsqkmwYo69GC7+wdhUmj9Tr1JnO1DuOQvoh55t1pmHv7Hg0k7Pm 0xIw== X-Gm-Message-State: ALQs6tAzSEH+JLj2qGEGz15WR4aF9g1cZtb5Eg7TOqio27DPoyGjwZDd gFZnXnaL+cVKO0evdq264IbaqUi74T/e8uZMo2Ja2Q== X-Received: by 10.107.174.102 with SMTP id x99mr3596706ioe.18.1523429873260; Tue, 10 Apr 2018 23:57:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.222.20 with HTTP; Tue, 10 Apr 2018 23:57:32 -0700 (PDT) In-Reply-To: <20180410110412.GG14248@e110439-lin> References: <20180406172835.20078-1-patrick.bellasi@arm.com> <20180410110412.GG14248@e110439-lin> From: Vincent Guittot Date: Wed, 11 Apr 2018 08:57:32 +0200 Message-ID: Subject: Re: [PATCH] sched/fair: schedutil: update only with all info available To: Patrick Bellasi Cc: Peter Zijlstra , linux-kernel , "open list:THERMAL" , Ingo Molnar , "Rafael J . Wysocki" , Viresh Kumar , Juri Lelli , Joel Fernandes , Steve Muckle , Dietmar Eggemann , Morten Rasmussen 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 10 April 2018 at 13:04, Patrick Bellasi wrote: > Hi Vincent, > > On 09-Apr 10:51, Vincent Guittot wrote: >> Hi Patrick >> >> On 6 April 2018 at 19:28, Patrick Bellasi wrote: >> > Schedutil is not properly updated when the first FAIR task wakes up on a >> > CPU and when a RQ is (un)throttled. This is mainly due to the current >> > integration strategy, which relies on updates being triggered implicitly >> > each time a cfs_rq's utilization is updated. >> > >> > Those updates are currently provided (mainly) via >> > cfs_rq_util_change() >> > which is used in: >> > - update_cfs_rq_load_avg() >> > when the utilization of a cfs_rq is updated >> > - {attach,detach}_entity_load_avg() >> > This is done based on the idea that "we should callback schedutil >> > frequently enough" to properly update the CPU frequency at every >> > utilization change. >> > >> > Since this recent schedutil update: >> > >> > commit 8f111bc357aa ("cpufreq/schedutil: Rewrite CPUFREQ_RT support") >> > >> > we use additional RQ information to properly account for FAIR tasks >> > utilization. Specifically, cfs_rq::h_nr_running has to be non-zero >> > in sugov_aggregate_util() to sum up the cfs_rq's utilization. >> >> Isn't the use of cfs_rq::h_nr_running, the root cause of the problem ? > > Not really... > >> I can now see a lot a frequency changes on my hikey with this new >> condition in sugov_aggregate_util(). >> With a rt-app UC that creates a periodic cfs task, I have a lot of >> frequency changes instead of staying at the same frequency > > I don't remember a similar behavior... but I'll check better. I have discovered this behavior quite recently while preparing OSPM > >> Peter, >> what was your goal with adding the condition "if >> (rq->cfs.h_nr_running)" for the aggragation of CFS utilization > > The original intent was to get rid of sched class flags, used to track > which class has tasks runnable from within schedutil. The reason was > to solve some misalignment between scheduler class status and > schedutil status. This was mainly for RT tasks but it was not the case for cfs task before commit 8f111bc357aa > > The solution, initially suggested by Viresh, and finally proposed by > Peter was to exploit RQ knowledges directly from within schedutil. > > The problem is that now schedutil updated depends on two information: > utilization changes and number of RT and CFS runnable tasks. > > Thus, using cfs_rq::h_nr_running is not the problem... it's actually > part of a much more clean solution of the code we used to have. So there are 2 problems there: - using cfs_rq::h_nr_running when aggregating cfs utilization which generates a lot of frequency drop - making sure that the nr-running are up-to-date when used in sched_util > > The problem, IMO is that we now depend on other information which > needs to be in sync before calling schedutil... and the patch I > proposed is meant to make it less likely that all the information > required are not aligned (also in the future). > > -- > #include > > Patrick Bellasi