Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp637129imm; Wed, 6 Jun 2018 03:39:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJwoUfdJKEqrhweDrDEDlY+49Bc4nvzTf8YAG7BLxfNqNEJA5iwQEg92BkiOiPM/SUXZWtI X-Received: by 2002:a65:61a7:: with SMTP id i7-v6mr2159917pgv.219.1528281574295; Wed, 06 Jun 2018 03:39:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528281574; cv=none; d=google.com; s=arc-20160816; b=S+ZsONI1mJjlTOLY6/GRVdo3kbuKg0kwihtx4OY0a2tk94KeQb4aHOI+tgC6xIDHm1 bSt/X22HgtGNdseCmG7rSG6MQgL2JO3TzErArOoBdgofgDh9EiyDap9Z8cP/IDiOoh6/ 1RsJFeGqwHVQfANRkelmaDC3kuRBFCTa7cZq/DHsW9emTxs1Tq5Tw2FqxO35ywGb5fe0 tt5+vmvPldi4HCYSz7f3tPkkPBRpmw1CjTYDAjhzapg7LUj7EUaB6kj2s+h5SztDoEe7 4KFGFdXAQyNiiTYGfv3EbKRUmQ9ee4+QwKezy9r/xnuxFQxkhQh1rYzO0ZlUgzmwv7dN lc8Q== 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:arc-authentication-results; bh=bYGTcK3yaJss8MESPXu8aNgfgqKoYQEKK45m9+LkT0U=; b=IoV81ALOzAUY1gHjEF0XQ1zECNrfVLeFGOVtDDTGxLw0x0ZLe/nIuggIfJzc4fQaum gnU5RugwOaKPPOjIa6HQY7A1uij6zWZJMdlpC7rW94btS/u44WzTs+fhOk9sYjHt34sG hkfJ8ftbKjCYOaEeiDow7dtmdpzU0oF+gqCRR+yi0ecDMSg8Ti67atbpm+TAnSGE/c8B BQp+qvgwtQXyvm8m+CdBWPB/OqFsU+RrrwiUS8HEHneewHcR8M88FdpDAhx2ATLaW1H/ 6UbyCnZq6t8vQT7WN8AMj7XbA7PYKNkbHuPFt8yHQqgM/lGFdHR5McdinoYPEo23ewcs gHaA== 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 p3-v6si48971551pfb.171.2018.06.06.03.39.20; Wed, 06 Jun 2018 03:39:34 -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; 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 S932615AbeFFKiP (ORCPT + 99 others); Wed, 6 Jun 2018 06:38:15 -0400 Received: from foss.arm.com ([217.140.101.70]:39190 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932518AbeFFKiO (ORCPT ); Wed, 6 Jun 2018 06:38:14 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BECED15AB; Wed, 6 Jun 2018 03:38:13 -0700 (PDT) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.210.68]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 88CD33F557; Wed, 6 Jun 2018 03:38:11 -0700 (PDT) Date: Wed, 6 Jun 2018 11:38:09 +0100 From: Patrick Bellasi To: Vincent Guittot Cc: linux-kernel , "open list:THERMAL" , Ingo Molnar , Peter Zijlstra , "Rafael J . Wysocki" , Viresh Kumar , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Joel Fernandes , Steve Muckle , Todd Kjos Subject: Re: [PATCH 2/2] sched/fair: util_est: add running_sum tracking Message-ID: <20180606103809.GG31675@e110439-lin> References: <20180604160600.22052-1-patrick.bellasi@arm.com> <20180604160600.22052-3-patrick.bellasi@arm.com> <20180605151129.GC32302@e110439-lin> <20180606082640.GA14694@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180606082640.GA14694@linaro.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vincent, On 06-Jun 10:26, Vincent Guittot wrote: [...] > For the above 2 tasks of the example example we have the pattern > > Task 1 > state RRRRSSSSSSERRRRSSSSSSERRRRSSSSSS > util_avg AAAADDDDDD AAAADDDDDD AAAADDDDDD > > Task 2 > state WWWWRRRRSSEWWWWRRRRSSEWWWWRRRRSS > util_avg DDDDAAAADD DDDDAAAADD DDDDAAAADD > running_avg AAAADDC AAAADDC AAAADD > > R : Running 1ms, S: Sleep 1ms , W: Wait 1ms, E: Enqueue event > A: Accumulate 1ms, D: Decay 1ms, C: Copy util_avg value > > the util_avg of T1 and T2 have the same pattern which is: > AAAADDDDDDAAAADDDDDDAAAADDDDDD > and as a result, the same value which represents their utilization > > For the running_avg of T2, there is only 2 decays aftert the last running > phase and before the next enqueue > so the pattern will be AAAADDAAAA > instead of the AAAADDDDDDAAAA > > the runninh_avg will report a higher value than reality Right!... Your example above is really useful, thanks. Reasoning on the same line, we can easily see that a 50% CFS task co-scheduled with a 50% RT task, which delays the CFS one and has the same period, will make the CFS task appear as a 100% task. Which is definitively not what we want to sample as estimated utilization. The good news, if we like, is instead that util_avg is already correctly reporting 50% at the end of each activation and thus, when we collect util_est samples we already have the best utilization value we can collect for a task. The only time we collect "wrong" estimation samples is when there is not idle time, thus eventually util_est should be improved by discarding samples in that cases... but I'm not entirely sure if and how we can detect them. Or just to ensure we have idle time... as you are proposing in the other thread. Thanks again for pointing out the issue above. -- #include Patrick Bellasi