[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <169684717032.3135.17626767741431018350.tip-bot2@tip-bot2>
Date: Mon, 09 Oct 2023 10:26:10 -0000
From: "tip-bot2 for Ingo Molnar" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Ingo Molnar <mingo@...nel.org>,
"Joel Fernandes (Google)" <joel@...lfernandes.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: sched/core] sched/nohz: Remove unnecessarily complex error
handling pattern from find_new_ilb()
The following commit has been merged into the sched/core branch of tip:
Commit-ID: f4bb5705114530cd775a5a649b666755b3efe7aa
Gitweb: https://git.kernel.org/tip/f4bb5705114530cd775a5a649b666755b3efe7aa
Author: Ingo Molnar <mingo@...nel.org>
AuthorDate: Fri, 06 Oct 2023 12:25:18 +02:00
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Mon, 09 Oct 2023 12:21:23 +02:00
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 <mingo@...nel.org>
Reviewed-by: Joel Fernandes (Google) <joel@...lfernandes.org>
Link: https://lore.kernel.org/r/20231006102518.2452758-4-mingo@kernel.org
---
kernel/sched/fair.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index f82b301..19bb4ac 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -11528,7 +11528,7 @@ static inline int find_new_ilb(void)
return ilb_cpu;
}
- return nr_cpu_ids;
+ return -1;
}
/*
@@ -11549,8 +11549,7 @@ static void kick_ilb(unsigned int flags)
nohz.next_balance = jiffies+1;
ilb_cpu = find_new_ilb();
-
- if (ilb_cpu >= nr_cpu_ids)
+ if (ilb_cpu < 0)
return;
/*
Powered by blists - more mailing lists