Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp437566ybk; Wed, 20 May 2020 03:31:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyphbwZxgF74WrYur03QzvqA30KowbPtHUmmBXh6yDsEVMpRFx4OWjesEKKyucKiwQq+s29 X-Received: by 2002:a17:906:3943:: with SMTP id g3mr3110278eje.454.1589970713678; Wed, 20 May 2020 03:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589970713; cv=none; d=google.com; s=arc-20160816; b=CYGg+RFZ/1x5/eHgWXAB5baprdjC1t17sq0aNr6MJv7MjmgYfrMbDol6esgA5JRtBk O+vxPvi2aFmkfR+9XrpzWcMwEfxDHlUhmnchPOD7m4TRKDQehbe/Xxurap9y5mAKjYQO Dg4LxXMSf4du1ci1SoYWPiqY5lrzz3ADI+lhiCGWtR88uNmR0Kxk/9z+gd+9vaxD4rxL OI9h8Yar87VjletOHQJCF0ljqrYXgaiwKG6As0dpWqughaHeewswAgdbE5EXIJnMobbo WI4/3qBJL57A2ctOsGbOFAUdJ27BJWKruu6O42jz3Ng22vtUxIvc2+GO/64iOx76xVq5 iQHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=p1guHvQG6yPyO2a8UUBfoXqjdk5Rw9i1RPetE6RKm1o=; b=GsWcNjCMljvuvnmHH9h+gN2Oxc6ObSA5PJpshgYXKw5JjB8B+fHUg2BvOI9h5nDDk7 JqjC2T3ZcbHj+dnfz8dvL0Xm3aUnswibhkIIDWTImRFy30WsZG5Ys2i23qUWye+d7toF QL4gWrl7uAfNUi3na5OVjcPfEAMZmO4XDZEPeLoMIqC0R2jpoIVgTwtzMwajgZgoSF9o vz0qx4JqVdLX9Cxs+tgZoPNovl0McFzdQGmgjJmRDkCCPun2ZSQFTQr6bP4QoHbiDB0n f6IhLDcCj3Eo+1C8SWP8iikyLGRwagNpeuKQGtUhDkwP27QPwJq0EX+BUJ4PVCDnmKPT r+2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mh21si1442694ejb.561.2020.05.20.03.31.31; Wed, 20 May 2020 03:31:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726803AbgETKaB (ORCPT + 99 others); Wed, 20 May 2020 06:30:01 -0400 Received: from foss.arm.com ([217.140.110.172]:52518 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726510AbgETKaB (ORCPT ); Wed, 20 May 2020 06:30:01 -0400 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 7D4D831B; Wed, 20 May 2020 03:30:00 -0700 (PDT) Received: from [192.168.0.7] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3F6C53F68F; Wed, 20 May 2020 03:29:59 -0700 (PDT) Subject: Re: [PATCH v2] sched/pelt: sync util/runnable_sum with PELT window when propagating To: Vincent Guittot Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Steven Rostedt , Ben Segall , Mel Gorman , linux-kernel References: <20200506155301.14288-1-vincent.guittot@linaro.org> From: Dietmar Eggemann Message-ID: <7be0258e-9799-f85c-39ce-738d6e6a82bd@arm.com> Date: Wed, 20 May 2020 12:29:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/05/2020 17:41, Vincent Guittot wrote: > On Tue, 19 May 2020 at 12:28, Dietmar Eggemann wrote: >> >> On 06/05/2020 17:53, Vincent Guittot wrote: [...] >>> diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c >>> index b647d04d9c8b..1feff80e7e45 100644 >>> --- a/kernel/sched/pelt.c >>> +++ b/kernel/sched/pelt.c >>> @@ -237,6 +237,30 @@ ___update_load_sum(u64 now, struct sched_avg *sa, >>> return 1; >>> } >>> >>> +/* >>> + * When syncing *_avg with *_sum, we must take into account the current >>> + * position in the PELT segment otherwise the remaining part of the segment >>> + * will be considered as idle time whereas it's not yet elapsed and this will >>> + * generate unwanted oscillation in the range [1002..1024[. >>> + * >>> + * The max value of *_sum varies with the position in the time segment and is >>> + * equals to : >>> + * >>> + * LOAD_AVG_MAX*y + sa->period_contrib >>> + * >>> + * which can be simplified into: >>> + * >>> + * LOAD_AVG_MAX - 1024 + sa->period_contrib >>> + * >>> + * because LOAD_AVG_MAX*y == LOAD_AVG_MAX-1024 >> >> Isn't this rather '~' instead of '==', even for y^32 = 0.5 ? >> >> 47742 * 0.5^(1/32) ~ 47742 - 1024 > > With integer precision and the runnable_avg_yN_inv array, you've got > exactly 1024 Ah, OK, I forgot about this and that this is related to commit 625ed2bf049d ("sched/cfs: Make util/load_avg more stable").