Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5942877ybv; Tue, 18 Feb 2020 06:56:07 -0800 (PST) X-Google-Smtp-Source: APXvYqzn0w3uf8LRbJzMfFXCeBJKZGpe/sxW+QYoeeQCcjI/d9+T7UUR3lpgY1D8Qw85AAopdR+l X-Received: by 2002:aca:1204:: with SMTP id 4mr1505098ois.143.1582037767381; Tue, 18 Feb 2020 06:56:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582037767; cv=none; d=google.com; s=arc-20160816; b=OjuOKw4Vn7BKUOr5eN3tTXHP7WXiWFtu/oN0pmVzGc6yhDyP1Q+5FBIe8H2nhAerH8 nKx+82Ixs2A2sux4QI+GqvvG4HzxK+dxFIaVbav3+335x680rPUqv1vsU6dquIv9xsxJ +waFYBfFPRqTjNrutjjHVe3sPK9q0u322GyGhjjQuKIUtbmsQK4xtPN0yBDe6NCV0/Ca XAF4ITKETAVcxEqyTo7i9CcszDRdZ5d2VSTjAKmQZMw+hvOX0s3/eo/dvdR2qWkt5HHn s0Bg6VjhwwBpqbz5VZFzGQno0yUhJ2HorOGo0FIm74dL2hr32Vp17cdfJGdwJ4KhkcqU OaSQ== 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=lO0Vs8unGR8uhtZzVIYmX8ZeJ5ICI08QqfkBqRGkPHA=; b=vqfXHD/CfHcScBixr4LH3MmaGqm3fINCX7yIkp7U+IZgnPVOsubBp2avO+jVqEoT9N J/0iHK2Pf5U2dfSYbjFKnX2jHRng7QvtqRRgYy4rqIG8ejQjKGVwdEJuD/VsIFY0MGq0 iTvCIXPUZLGGP688OtIKMtyusiXuVOMWRiXawxgzGpSUtwKypLhUD3HInGrpvgQIaw1q e9v0OvuLi7I+BBGGuSrnfld4YgixhKt7oAsiRqFfUXlNzngrF2INc5egEQP47A04kk6p KolCWhYAvJUperTNDLh7/kI3kn2dcCI6fZmlH6fzU2cUbU90EM5ZvOzypEbebvQ6uNcC 9qtg== 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 w207si7482151oie.111.2020.02.18.06.55.55; Tue, 18 Feb 2020 06:56:07 -0800 (PST) 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 S1726764AbgBROyn (ORCPT + 99 others); Tue, 18 Feb 2020 09:54:43 -0500 Received: from foss.arm.com ([217.140.110.172]:53798 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726697AbgBROyn (ORCPT ); Tue, 18 Feb 2020 09:54:43 -0500 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 89D96328; Tue, 18 Feb 2020 06:54:42 -0800 (PST) Received: from [10.1.195.59] (ifrit.cambridge.arm.com [10.1.195.59]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1AF873F703; Tue, 18 Feb 2020 06:54:40 -0800 (PST) Subject: Re: [PATCH v2 4/5] sched/pelt: Add a new runnable average signal To: Vincent Guittot , mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, linux-kernel@vger.kernel.org Cc: pauld@redhat.com, parth@linux.ibm.com, hdanton@sina.com References: <20200214152729.6059-1-vincent.guittot@linaro.org> <20200214152729.6059-5-vincent.guittot@linaro.org> From: Valentin Schneider Message-ID: <5ea96f6e-433e-1520-56dc-a10e9a8e63c7@arm.com> Date: Tue, 18 Feb 2020 14:54:40 +0000 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200214152729.6059-5-vincent.guittot@linaro.org> 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 2/14/20 3:27 PM, Vincent Guittot wrote: > @@ -532,8 +535,8 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) > cfs_rq->removed.load_avg); > SEQ_printf(m, " .%-30s: %ld\n", "removed.util_avg", > cfs_rq->removed.util_avg); > - SEQ_printf(m, " .%-30s: %ld\n", "removed.runnable_sum", > - cfs_rq->removed.runnable_sum); Shouldn't that have been part of patch 3? > + SEQ_printf(m, " .%-30s: %ld\n", "removed.runnable_avg", > + cfs_rq->removed.runnable_avg); > #ifdef CONFIG_FAIR_GROUP_SCHED > SEQ_printf(m, " .%-30s: %lu\n", "tg_load_avg_contrib", > cfs_rq->tg_load_avg_contrib); > @@ -3278,6 +3280,32 @@ update_tg_cfs_util(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq > cfs_rq->avg.util_sum = cfs_rq->avg.util_avg * LOAD_AVG_MAX; > } > > +static inline void > +update_tg_cfs_runnable(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq *gcfs_rq) > +{ > + long delta = gcfs_rq->avg.runnable_avg - se->avg.runnable_avg; > + > + /* 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. > + */ > + > + /* Set new sched_entity's runnable */ > + se->avg.runnable_avg = gcfs_rq->avg.runnable_avg; > + se->avg.runnable_sum = se->avg.runnable_avg * LOAD_AVG_MAX; > + > + /* Update parent cfs_rq runnable */ > + add_positive(&cfs_rq->avg.runnable_avg, delta); > + cfs_rq->avg.runnable_sum = cfs_rq->avg.runnable_avg * LOAD_AVG_MAX; > +} > + Humph, that's an exact copy of update_tg_cfs_util(). FWIW the following eldritch horror compiles... --- diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 99249a2484b4..be796532a2d3 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3254,57 +3254,34 @@ void set_task_rq_fair(struct sched_entity *se, * */ -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; - - /* 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. - */ - - /* Set new sched_entity's utilization */ - se->avg.util_avg = gcfs_rq->avg.util_avg; - se->avg.util_sum = se->avg.util_avg * LOAD_AVG_MAX; - - /* Update parent cfs_rq utilization */ - add_positive(&cfs_rq->avg.util_avg, delta); - cfs_rq->avg.util_sum = cfs_rq->avg.util_avg * LOAD_AVG_MAX; -} - -static inline void -update_tg_cfs_runnable(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq *gcfs_rq) -{ - long delta = gcfs_rq->avg.runnable_avg - se->avg.runnable_avg; - - /* 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. - */ - - /* Set new sched_entity's runnable */ - se->avg.runnable_avg = gcfs_rq->avg.runnable_avg; - se->avg.runnable_sum = se->avg.runnable_avg * LOAD_AVG_MAX; +#define DECLARE_UPDATE_TG_CFS_SIGNAL(signal) \ +static inline void \ +update_tg_cfs_##signal(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq *gcfs_rq) \ +{ \ + long delta = gcfs_rq->avg.signal##_avg - se->avg.signal##_avg; \ + \ + /* 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. \ + */ \ + /* Set new sched_entity's runnable */ \ + se->avg.signal##_avg = gcfs_rq->avg.signal##_avg; \ + se->avg.signal##_sum = se->avg.signal##_avg * LOAD_AVG_MAX; \ + \ + /* Update parent cfs_rq signal## */ \ + add_positive(&cfs_rq->avg.signal##_avg, delta); \ + cfs_rq->avg.signal##_sum = cfs_rq->avg.signal##_avg * LOAD_AVG_MAX; \ +} \ - /* Update parent cfs_rq runnable */ - add_positive(&cfs_rq->avg.runnable_avg, delta); - cfs_rq->avg.runnable_sum = cfs_rq->avg.runnable_avg * LOAD_AVG_MAX; -} +DECLARE_UPDATE_TG_CFS_SIGNAL(util); +DECLARE_UPDATE_TG_CFS_SIGNAL(runnable); static inline void update_tg_cfs_load(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq *gcfs_rq) --- > static inline void > update_tg_cfs_load(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq *gcfs_rq) > { > @@ -3358,6 +3386,7 @@ static inline int propagate_entity_load_avg(struct sched_entity *se) > add_tg_cfs_propagate(cfs_rq, gcfs_rq->prop_runnable_sum); > > update_tg_cfs_util(cfs_rq, se, gcfs_rq); > + update_tg_cfs_runnable(cfs_rq, se, gcfs_rq); > update_tg_cfs_load(cfs_rq, se, gcfs_rq); > > trace_pelt_cfs_tp(cfs_rq); > @@ -3439,7 +3468,7 @@ update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq) > raw_spin_lock(&cfs_rq->removed.lock); > swap(cfs_rq->removed.util_avg, removed_util); > swap(cfs_rq->removed.load_avg, removed_load); > - swap(cfs_rq->removed.runnable_sum, removed_runnable_sum); Ditto on the stray from patch 3? > + swap(cfs_rq->removed.runnable_avg, removed_runnable); > cfs_rq->removed.nr = 0; > raw_spin_unlock(&cfs_rq->removed.lock); > > @@ -3451,7 +3480,16 @@ update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq)