Skip to content

Commit f4bb570

Browse files
author
Ingo Molnar
committed
sched/nohz: Remove unnecessarily complex error handling pattern from find_new_ilb()
find_new_ilb() returns nr_cpu_ids on failure - which is the usual cpumask bitops return pattern, but is weird & unnecessary in this context: not only is it a global variable, it it is a +1 out of bounds CPU index and also has different signedness ... Its only user, kick_ilb(), then checks the return against nr_cpu_ids to decide to return. There's no other use. So instead of this, use a standard -1 return on failure to find an idle CPU, as the argument is signed already. Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Joel Fernandes (Google) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b6dd698 commit f4bb570

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

kernel/sched/fair.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11528,7 +11528,7 @@ static inline int find_new_ilb(void)
1152811528
return ilb_cpu;
1152911529
}
1153011530

11531-
return nr_cpu_ids;
11531+
return -1;
1153211532
}
1153311533

1153411534
/*
@@ -11549,8 +11549,7 @@ static void kick_ilb(unsigned int flags)
1154911549
nohz.next_balance = jiffies+1;
1155011550

1155111551
ilb_cpu = find_new_ilb();
11552-
11553-
if (ilb_cpu >= nr_cpu_ids)
11552+
if (ilb_cpu < 0)
1155411553
return;
1155511554

1155611555
/*

0 commit comments

Comments
 (0)