From patchwork Tue Dec 5 17:10:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Bellasi X-Patchwork-Id: 120719 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp6004538qgn; Tue, 5 Dec 2017 09:11:20 -0800 (PST) X-Google-Smtp-Source: AGs4zMZWwQGY+lOuLpp2DNQOcBM0Sjpqi2B2hd0j8c024CqDP8yEONBxRaa/sbhAaHN5GK9vSQeK X-Received: by 10.99.115.79 with SMTP id d15mr18609784pgn.340.1512493880819; Tue, 05 Dec 2017 09:11:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512493880; cv=none; d=google.com; s=arc-20160816; b=LnGnlk7DV05MO0LahL8Lahxdsek+JA/zfOHuh7cD1bUmN9xpJMR3AGW1Sh4y06Rjp4 qKJQXxnO101nxkJvgnegxXro2Ra+T0qsOcWa3ki7SUvy/LEyPGIyecFdVt4X62aW14mH Fab5qkoP/SBWHv+trBecod6R5kMMYP8IOnTju8dK6owv2oWBcME2hRl7TDNhGOqdCW6Q y2aMmw/2HA03jGoKC50hHcbhgUF7LpnbD7sIUzsk/4rQvMtytpGqP7bIK7Y0QjqzLVYl Wxq/20n00MpmlAuOsmi2TiPutXyjL6VjAVzGQzZ7+CT6kANjm6FAAZDcyiIGd13shNi6 SG3A== 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=aKC8satZkuqirdZ0/kSttaQgxbK9Pbfa/ju+uTAFL/M=; b=wJ6Mr3hayrm3vB4tvAGc/ueKK+R4Lb1DQJjjo/sqdFTB+ISG70gChbZBvsI1m59iu+ oWetI0MUnqWPNJjCnVtalNMyNlvJuVaTVRKRiRn5YREXIrHDkoahu0XhZDm1tlFEhKmd qbzQqtan/A423s5b1uQ/MC3GaH39/LNEvDmKK6KvdzTdroYeRRgexaLoI/7YTcwkQnad gZ9useQGIGNkX5gYiAoaIqPn1HL1jwN9wmq4AsM3tXus2jI3IktgrkDcC7zRLMGujBvR Kn9YhPsPn6pxStdH/IRhiMM6pfeIkTdGDjW3q1Mw4BAUecq+NJ9NeT98nFsMAvMUnint K5wQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 f4si331093plr.643.2017.12.05.09.11.20; Tue, 05 Dec 2017 09:11:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753063AbdLERLT (ORCPT + 11 others); Tue, 5 Dec 2017 12:11:19 -0500 Received: from foss.arm.com ([217.140.101.70]:52290 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752902AbdLERKi (ORCPT ); Tue, 5 Dec 2017 12:10:38 -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 5A2C61596; Tue, 5 Dec 2017 09:10:38 -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 0051B3F246; Tue, 5 Dec 2017 09:10:35 -0800 (PST) From: Patrick Bellasi To: linux-kernel@vger.kernel.org, linux-pm@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 v2 1/4] sched/fair: always used unsigned long for utilization Date: Tue, 5 Dec 2017 17:10:15 +0000 Message-Id: <20171205171018.9203-2-patrick.bellasi@arm.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171205171018.9203-1-patrick.bellasi@arm.com> References: <20171205171018.9203-1-patrick.bellasi@arm.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 --- 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(-) -- 2.14.1 Acked-by: Vincent Guittot 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;