From patchwork Thu Nov 9 16:41:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Bellasi X-Patchwork-Id: 118462 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6815904qgn; Thu, 9 Nov 2017 08:41:43 -0800 (PST) X-Google-Smtp-Source: ABhQp+QMjW9En5mEXOfnO2bJ+WfpbEfG4gjtnDrRhELCGKX+1qH/bZ/Sn/VY8fCS/vUW1eqw5KlF X-Received: by 10.84.168.100 with SMTP id e91mr998314plb.430.1510245703350; Thu, 09 Nov 2017 08:41:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510245703; cv=none; d=google.com; s=arc-20160816; b=Fh78s6lgjGhR4E36OJVeIv8kCaXyzvNOXi++OkP9lu3/0WBUJUNVmMQ9hc7nIh1Wfu Ok6TVLgWeB1cW9FWKAjNKRkV+drDE1YySqLnA3iP11oUWe26PKG4T6FSvVqlA1wuEBNt pQDCCI0KN78YrLnbcK6+OO1qHVxnY/uvpucXxV2fvlHkigkzXnpKIsbXERdRimriD6Vr wXI4t7gSPwweSkJxmCOYA1ct0no/d4IUgxXJsMgnDEQkkJEQH92W7yKeAIV76rjptNtn xBuJEFmjIRZwCK3tUCTPxOqSmtIE6TYZHZv5JqQUDtu/1vw5ixjDsqLuEmYtacDTuPXq 6weA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=nFtDdCaJEjvTDpwIkMZSRNO9Wo3MFMD097gWslC/r3U=; b=g9ZH2mr9UUobl4k2Km3DEDM5qPubGBL7kVEe4yhxEVnIs3Z0GqxvTvCA4EDE3GRmUG 2+PtsOEx9kJTnR7TMYZZa5xyfaB/dhQ30YjXbd85HP+Vif81g+8rPLX6+IKN0FrA12qE Vi/wFU0lgzQ2QKzveYgf9cjru7xajItS1+jwBFRL9snrX+JTSZfK7CYizbL+116aeUFy kmRo/Ni2dfHDslKzjVb3ouKs2iOWKLbs2gaM0vVm8yp6uLrAsxzXUt31qjNVzvmpjaFS WbnlDyh79o5LhXWzqW72iEqFiM9/wDWUkKkwdTU5yNyjpI8VkHy9XmABLKzDP/3+A0NP YvKA== 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 e9si6431324pgo.708.2017.11.09.08.41.43; Thu, 09 Nov 2017 08:41:43 -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 S1753480AbdKIQlk (ORCPT + 23 others); Thu, 9 Nov 2017 11:41:40 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:49210 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753007AbdKIQlh (ORCPT ); Thu, 9 Nov 2017 11:41:37 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 808B315A2; Thu, 9 Nov 2017 08:41:37 -0800 (PST) Received: from e110439-lin.cambridge.arm.com (e110439-lin.cambridge.arm.com [10.1.210.68]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4A93D3F3DF; Thu, 9 Nov 2017 08:41:35 -0800 (PST) From: Patrick Bellasi To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , "Rafael J . Wysocki" , Viresh Kumar , Vincent Guittot , Paul Turner , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes Subject: [PATCH 1/4] sched/fair: always used unsigned long for utilization Date: Thu, 9 Nov 2017 16:41:14 +0000 Message-Id: <20171109164117.19401-2-patrick.bellasi@arm.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171109164117.19401-1-patrick.bellasi@arm.com> References: <20171109164117.19401-1-patrick.bellasi@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Utilization and capacity are tracked as unsigned long, however some functions using them returns 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 voiding 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 --- kernel/sched/fair.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.14.1 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 5c09ddf8c832..83bc5d69fe3a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5438,8 +5438,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) { @@ -5870,7 +5870,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); @@ -5878,7 +5878,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; } @@ -5887,7 +5887,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;