Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3393729rdb; Wed, 13 Sep 2023 10:35:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFpkxm7Ca2wlJV7E3La3yGH0kHONP2Wz8mmorleqx+lsKuBuM3Dt0SDADvztCgPC3iEHzaq X-Received: by 2002:a05:6a00:168a:b0:68a:5877:bfb1 with SMTP id k10-20020a056a00168a00b0068a5877bfb1mr4295033pfc.20.1694626545317; Wed, 13 Sep 2023 10:35:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694626545; cv=none; d=google.com; s=arc-20160816; b=gVFT79+0gjnkqJpMSbHLi3I1OKckZEUPRQ+UzQGHDwNSMf9Q62FoZhtcZX0QsYVe3r 08iiAeBMbT0AEzbF6+ChdjXUQ4BSmwwqEDxgFBy1Qe1L/gEQPXWKX84LbxNoFyIE+5rm N7B65z+Dc4a22x71iL9tTuKuYiJYfa49DBjSN0JgKwBp/XPc1ili+oNkS8fENVawNliL e/r+HnXBXaRskeOqmII2j+7RC9njHb9k5Bp+fnrng58Q95iFLF8dUgsZojZcfa/mM26d SLZ+B4bkO0lyanMeUltvBVwCRe+3DbWYSN236MMMrAJJpshdFBwx8QeBBoBYvoAmjmmp 9H1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=XFMYlGTswifA+HgSEy277/GvmCjNmW7ejz163uSjDz0=; fh=LC5d/w5IcQs52RrURJWInMfRNlsCNm+aQ8XhFKu0Frg=; b=N9V40q1JIZvCqDjNAY/icS9EmMxxhMRx+lvXH9YmC9zGz4EjIF4V3iIxM8c1mcAsbh B2kMvCM9k6Ap8NkduFECqwtl7V7DYAwrpQJZCP81+4AYkvL6T0DWCwMhnPQNRyAN3SiW ZJZ+1qOP4tcE4PT/U4KQ2PAVYx5j8moEole9D5LBA5OryrdTpJXGtvKG0t+T6ozPwIo8 JkcOJ+zff+d+RX00eb2mbNcMuHk4f417tWkyMGFZQ59Bl4LhFtJmgjnEymNjjQVCd5xl KCdHmCgX2MBZBCbLzuQPH+J7ehbf+LxwRU9EYvFJaBaFBE8ilSY7fDeFE2EfNzCQUmhQ 3WjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id b11-20020a6567cb000000b005698cf29f75si10603279pgs.222.2023.09.13.10.35.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 10:35:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id DFB778062359; Wed, 13 Sep 2023 10:22:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230476AbjIMRW0 (ORCPT + 99 others); Wed, 13 Sep 2023 13:22:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229744AbjIMRWZ (ORCPT ); Wed, 13 Sep 2023 13:22:25 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 370309B; Wed, 13 Sep 2023 10:22:21 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2EF9C1FB; Wed, 13 Sep 2023 10:22:58 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9B50B3F5A1; Wed, 13 Sep 2023 10:22:19 -0700 (PDT) Message-ID: <45548b21-280e-7f94-0b53-f2dcab6ccb5e@arm.com> Date: Wed, 13 Sep 2023 19:22:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [RFC PATCH 1/7] sched/pelt: Add a new function to approximate the future util_avg value Content-Language: en-US To: Qais Yousef Cc: Ingo Molnar , Peter Zijlstra , "Rafael J. Wysocki" , Viresh Kumar , Vincent Guittot , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Lukasz Luba References: <20230827233203.1315953-1-qyousef@layalina.io> <20230827233203.1315953-2-qyousef@layalina.io> <8f63efa6-f9d1-9b1c-7737-4094f6acfc62@arm.com> <20230906211936.yqejc25czc6tddm6@airbuntu> <47a11e4e-d349-7d98-7006-4bf08a53c0cf@arm.com> <20230910195832.pncjsqmkepichly6@airbuntu> From: Dietmar Eggemann In-Reply-To: <20230910195832.pncjsqmkepichly6@airbuntu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 13 Sep 2023 10:22:35 -0700 (PDT) X-Spam-Status: No, score=-2.2 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email On 10/09/2023 21:58, Qais Yousef wrote: > On 09/07/23 13:12, Dietmar Eggemann wrote: >> On 06/09/2023 23:19, Qais Yousef wrote: >>> On 09/06/23 14:56, Dietmar Eggemann wrote: >>>> On 28/08/2023 01:31, Qais Yousef wrote: [...] >> Another thing ... I guess if you call accumulate_sum with delta the PELT >> machinery assumes `delta = now - sa->last_update_time` which means you >> would have to use `clock_pelt + TICK_USEC` as delta. > > Right. > > The way I understood it is that at TICK we should do update_load_avg() which > would call __update_load_sum() which uses > > delta = now - sa->last_update_time > > which passes this delta to accumulate_sum() > > I can see we are not very accurate since there will be a small additional time > besides TICK_USEC that we are not accounting for. But I can't see how this can > cause a big error. > > predicted (assumed) tick time/delta > > sa->last_update_time = now > tick_time = TICK_USEC + now > > delta = tick_time - sa->last_update_time > delta = TICK_USEC + now - now > delta = TICK_USEC > > but actual tick time/delta > > sa->last_update_time = now - x > tick_time = TICK_USEC + now > > delta = tick_time - sa->last_update_time > delta = TICK_USEC + now - (now - x) > delta = TICK_USEC + x > > So the delta I am using might be slightly shorter than it should be. > > IIUC, what you're saying that the `x` in my equation above is clock_pelt, > right? No, I was wrong here. Calling accumulate_sum with `delta = TICK_USEC` is fine. accumulate_sum() will accrue `sa->util.sum` and ___update_load_avg() will then adjust `sa->util_avg` accordingly. delta should be 4000 on Arm64 boards so you will cross period boundaries. In case `delta < 1024` you might want to not call ___update_load_avg() to be in pair with __update_load_avg_cfs_rq().