Skip to content

Commit f01415f

Browse files
derklingIngo Molnar
authored andcommitted
sched/fair: Use 'unsigned long' for utilization, consistently
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, consolidate the signature of functions returning utilization to always use the native type. This change improves code consistency, and it also benefits code paths where utilizations should be clamped by avoiding further type conversions or ugly type casts. Signed-off-by: Patrick Bellasi <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Chris Redpath <[email protected]> Reviewed-by: Brendan Jackman <[email protected]> Reviewed-by: Dietmar Eggemann <[email protected]> Cc: Joel Fernandes <[email protected]> Cc: Juri Lelli <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Morten Rasmussen <[email protected]> Cc: Paul Turner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rafael J . Wysocki <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Todd Kjos <[email protected]> Cc: Vincent Guittot <[email protected]> Cc: Viresh Kumar <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 31cb1bc commit f01415f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

kernel/sched/fair.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5765,8 +5765,8 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p,
57655765
return affine;
57665766
}
57675767

5768-
static inline int task_util(struct task_struct *p);
5769-
static int cpu_util_wake(int cpu, struct task_struct *p);
5768+
static inline unsigned long task_util(struct task_struct *p);
5769+
static unsigned long cpu_util_wake(int cpu, struct task_struct *p);
57705770

57715771
static unsigned long capacity_spare_wake(int cpu, struct task_struct *p)
57725772
{
@@ -6247,15 +6247,15 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target)
62476247
* capacity_orig) as it useful for predicting the capacity required after task
62486248
* migrations (scheduler-driven DVFS).
62496249
*/
6250-
static int cpu_util(int cpu)
6250+
static unsigned long cpu_util(int cpu)
62516251
{
62526252
unsigned long util = cpu_rq(cpu)->cfs.avg.util_avg;
62536253
unsigned long capacity = capacity_orig_of(cpu);
62546254

62556255
return (util >= capacity) ? capacity : util;
62566256
}
62576257

6258-
static inline int task_util(struct task_struct *p)
6258+
static inline unsigned long task_util(struct task_struct *p)
62596259
{
62606260
return p->se.avg.util_avg;
62616261
}
@@ -6264,7 +6264,7 @@ static inline int task_util(struct task_struct *p)
62646264
* cpu_util_wake: Compute cpu utilization with any contributions from
62656265
* the waking task p removed.
62666266
*/
6267-
static int cpu_util_wake(int cpu, struct task_struct *p)
6267+
static unsigned long cpu_util_wake(int cpu, struct task_struct *p)
62686268
{
62696269
unsigned long util, capacity;
62706270

0 commit comments

Comments
 (0)