Received: by 10.223.164.202 with SMTP id h10csp445484wrb; Thu, 9 Nov 2017 08:44:07 -0800 (PST) X-Google-Smtp-Source: ABhQp+RPW344zltYsqPoz7YgYq0xk+OOsIA3qAeL2DP+QzGPa7DRofCdypK45LiUzkUDmphJzUIY X-Received: by 10.98.242.15 with SMTP id m15mr1095217pfh.176.1510245847393; Thu, 09 Nov 2017 08:44:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510245847; cv=none; d=google.com; s=arc-20160816; b=FYAc4aZR1j+N1Rpmi6MDuYF2z8lLZHLzuzCe+YUXJpeHypWf6dM2wJiXP2PBhSplvP pKhMyn+njZZisPxVkijLdMcm1IIuPftY0cr96keam2i8UmzTZEOMe4a1bPpDAFCSs66l f9Q/LbSs8evXo0XgNB8tGkVJIoUTH49qWiMU3bLVl9RxBhwbZ7glrSpLNqOrv9hm1ApW mC47ZqSPaVA9BDNPudcV3Rq3FrSnRYaRqlQqrk9Zx2PiLRhj84n0jqYIhqy6F4nQX7/L c5F5dDA+FEHi+JNuM/FmI8ys6zPqpWLIYPllC7RtEPOxecOuXmNq6veCjRFKUfZ7O/iO gTBA== 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 q8si6668893pgv.516.2017.11.09.08.43.55; Thu, 09 Nov 2017 08:44: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 S1753475AbdKIQlk (ORCPT + 81 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(-) 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; -- 2.14.1 From 1583720918593689417@xxx Fri Nov 10 22:46:04 +0000 2017 X-GM-THRID: 1583720918593689417 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread