Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754191AbdLFI47 (ORCPT ); Wed, 6 Dec 2017 03:56:59 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:44644 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753582AbdLFI4z (ORCPT ); Wed, 6 Dec 2017 03:56:55 -0500 X-Google-Smtp-Source: AGs4zMaktloXiz6jAJbmKM8Tq68RBlicOESS00pZUx5JKu47B0utjnukyjOaolFPO15RV/yQaKmJISmzi7C+nU2CY1Q= MIME-Version: 1.0 In-Reply-To: <20171205171018.9203-2-patrick.bellasi@arm.com> References: <20171205171018.9203-1-patrick.bellasi@arm.com> <20171205171018.9203-2-patrick.bellasi@arm.com> From: Vincent Guittot Date: Wed, 6 Dec 2017 09:56:34 +0100 Message-ID: Subject: Re: [PATCH v2 1/4] sched/fair: always used unsigned long for utilization To: Patrick Bellasi Cc: linux-kernel , "linux-pm@vger.kernel.org" , Ingo Molnar , Peter Zijlstra , "Rafael J . Wysocki" , Viresh Kumar , Paul Turner , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3082 Lines: 79 On 5 December 2017 at 18:10, Patrick Bellasi wrote: > Utilization and capacity are tracked as unsigned long, however some > functions using them return an int which is ultimately assigned back to > unsigned long variables. > > Since there is not scope on using a different and signed type, this > consolidate the signature of functions returning utilization to always > use the native type. > As well as improving code consistency this is expected also benefits > code paths where utilizations should be clamped by avoiding further type > conversions or ugly type casts. > > Signed-off-by: Patrick Bellasi > Reviewed-by: Chris Redpath > Reviewed-by: Brendan Jackman > Reviewed-by: Dietmar Eggemann > Cc: Ingo Molnar > Cc: Peter Zijlstra > Cc: Vincent Guittot > Cc: Morten Rasmussen > Cc: Dietmar Eggemann > Cc: linux-kernel@vger.kernel.org Acked-by: Vincent Guittot > > --- > Changes v1->v2: > - rebase on top of v4.15-rc2 > - tested that overhauled PELT code does not affect the util_est > --- > kernel/sched/fair.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 4037e19bbca2..ad21550d008c 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -5721,8 +5721,8 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, > return affine; > } > > -static inline int task_util(struct task_struct *p); > -static int cpu_util_wake(int cpu, struct task_struct *p); > +static inline unsigned long task_util(struct task_struct *p); > +static unsigned long cpu_util_wake(int cpu, struct task_struct *p); > > static unsigned long capacity_spare_wake(int cpu, struct task_struct *p) > { > @@ -6203,7 +6203,7 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target) > * capacity_orig) as it useful for predicting the capacity required after task > * migrations (scheduler-driven DVFS). > */ > -static int cpu_util(int cpu) > +static unsigned long cpu_util(int cpu) > { > unsigned long util = cpu_rq(cpu)->cfs.avg.util_avg; > unsigned long capacity = capacity_orig_of(cpu); > @@ -6211,7 +6211,7 @@ static int cpu_util(int cpu) > return (util >= capacity) ? capacity : util; > } > > -static inline int task_util(struct task_struct *p) > +static inline unsigned long task_util(struct task_struct *p) > { > return p->se.avg.util_avg; > } > @@ -6220,7 +6220,7 @@ static inline int task_util(struct task_struct *p) > * cpu_util_wake: Compute cpu utilization with any contributions from > * the waking task p removed. > */ > -static int cpu_util_wake(int cpu, struct task_struct *p) > +static unsigned long cpu_util_wake(int cpu, struct task_struct *p) > { > unsigned long util, capacity; > > -- > 2.14.1 >