Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp368660ybz; Fri, 24 Apr 2020 01:44:22 -0700 (PDT) X-Google-Smtp-Source: APiQypL0awXwSwHxgfrokyKP/Y1NrM+iuobcoQdHpCoN3Qyj+LLxQZGam6FjJJZCQ3nwwvFFatap X-Received: by 2002:a17:906:1cd5:: with SMTP id i21mr6125144ejh.251.1587717862005; Fri, 24 Apr 2020 01:44:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587717861; cv=none; d=google.com; s=arc-20160816; b=BGf2cUxmqnOc6tXeAGO8qabXOnoOoI+MHk4+xow82PjWcQjYA1lbMvSLoDcij2XFGd GLmBbVX4MqEtvy41ZpFOt6OD4dMTweyVPKAitWvL4cnWnmcY5mp9Nkcowd2se1nQ5qmC HzzpXD6NED/0yPpljN4M4nHMZEEoIY6oOqf/Te6ibLgIWtUyRGuzZ/04onqFwGnUC1+0 +3i28sPfZLGwRWGF2u3K+8Yj5XWQeXdWfKIuVnh3zy4FbhhW3GdnK9X6LwtNKT+cfzYj xX+7rVV5qaaNEyHo4FaC1xylUarr21oh5tTu0M2+AbKOo6Ff2iFKieuFXNBHRUwNcbj2 AP9Q== 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=mK/YS6tIow23xWCDZLMm6lTkBaVsePBWLG0Lgifj4mg=; b=Zkfu5/33WqNI4lkPQ/Kyt3FPVvTS0FTc3EcoT45Wnm4oFPHBVt54WLhxWlj1MuRbnj 2asjedFyjDx3fJqwlRbn2WABhsPaELmFPLIvW54MPjVH2W0hI8oM5IewfGMyYVxcvOsP eED1m7QDLJZ8hk7fDPJwXPcnwqQ3AQ6gClTaod+mXgx9BGcGC4fsjlg1pzCYYyTO5Uto 6QxLRQlB2nuCuyTz4+5IoHuRbDeKSoKObWsej19AMioGgfXyviI6HgcVJ9q88EPilZ6V QJEv34v3auqM+44xv+kgOOnMF5aw/FBoP5YmPsb5Mj5aXgm2Otb/IYFdaieWvtN0zpqQ OVZQ== 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 r17si2851135edl.558.2020.04.24.01.43.59; Fri, 24 Apr 2020 01:44:21 -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 S1726779AbgDXIlt (ORCPT + 99 others); Fri, 24 Apr 2020 04:41:49 -0400 Received: from foss.arm.com ([217.140.110.172]:57428 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726737AbgDXIlt (ORCPT ); Fri, 24 Apr 2020 04:41:49 -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 9F37A1FB; Fri, 24 Apr 2020 01:41:48 -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 0E8543F68F; Fri, 24 Apr 2020 01:41:46 -0700 (PDT) Subject: Re: [PATCH] sched/pelt: sync util/runnable_sum with PELT window when propagating To: Vincent Guittot , Peter Zijlstra Cc: Ingo Molnar , Juri Lelli , Steven Rostedt , Ben Segall , Mel Gorman , linux-kernel References: <20200422151401.9147-1-vincent.guittot@linaro.org> <20200423192930.GY2483@worktop.programming.kicks-ass.net> From: Dietmar Eggemann Message-ID: <206b1f00-bb96-5e7f-f80a-b10cd88c8a71@arm.com> Date: Fri, 24 Apr 2020 10:41:44 +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 24/04/2020 09:37, Vincent Guittot wrote: > On Thu, 23 Apr 2020 at 21:29, Peter Zijlstra wrote: >> >> On Wed, Apr 22, 2020 at 05:14:01PM +0200, Vincent Guittot wrote: >>> update_tg_cfs_util/runnable() propagate the impact of the attach/detach of >>> an entity down into the cfs_rq hierarchy which must keep the sync with >>> the current pelt window. >>> >>> Even if we can't sync child rq and its group se, we can sync the group se >>> and parent cfs_rq with current PELT window. In fact, we must keep them sync >>> in order to stay also synced with others se and group se that are already >>> attached to the cfs_rq. >>> >>> Signed-off-by: Vincent Guittot >>> --- >>> kernel/sched/fair.c | 26 ++++++-------------------- >>> 1 file changed, 6 insertions(+), 20 deletions(-) >>> >>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >>> index 02f323b85b6d..ca6aa89c88f2 100644 >>> --- a/kernel/sched/fair.c >>> +++ b/kernel/sched/fair.c >>> @@ -3441,52 +3441,38 @@ static inline void >>> update_tg_cfs_util(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq *gcfs_rq) >>> { >>> long delta = gcfs_rq->avg.util_avg - se->avg.util_avg; >>> + u32 divider = LOAD_AVG_MAX - 1024 + cfs_rq->avg.period_contrib; >>> >>> /* Nothing to update */ >>> if (!delta) >>> return; >>> >>> - /* >>> - * The relation between sum and avg is: >>> - * >>> - * LOAD_AVG_MAX - 1024 + sa->period_contrib >>> - * >>> - * however, the PELT windows are not aligned between grq and gse. >>> - */ >> >> Instead of deleting this, could we perhaps extend it? > > In fact, this is not the only place in fair.c that uses this rule to > align _avg and _sum but others don't have any special comment. > > I can add a more detailed description of this relation for > ___update_load_avg() in pelt.c and make a ref to this in all places in > fair.c that use this rule which are : > - update_tg_cfs_util > - update_tg_cfs_runnable > - update_cfs_rq_load_avg > - attach_entity_load_avg > - reweight_entity But IMHO the "* however, the PELT windows are not aligned between grq and gse." should only apply to update_tg_cfs_util() and update_tg_cfs_runnable(). And attach_entity_load_avg() (for cfs_rq and se). They seem to be special since we derive divider from a cfs_rq PELT value and use it for a se PELT value. I assume this fact is specifically worth highlighting with a comment. I mean the fact we can do this because the decay windows are actually aligned.