On 3/27/23 04:40, Adrian Moreno wrote:
With the current implementation the available CPUs will not be read
until 10s have passed since the system's boot. For systems that boot
faster, this can make ovs-vswitchd create fewer handlers than necessary
for some time.
Fixes: 0d23948a598a ("ovs-thread: Detect changes in number of CPUs.")
Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2180460
Suggested-by: Ilya Maximets <[email protected]>
Signed-off-by: Adrian Moreno <[email protected]>
Acked-by: Michael Santana <[email protected]>
---
lib/ovs-thread.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c
index 2d382f1e8..ac5d2c3d0 100644
--- a/lib/ovs-thread.c
+++ b/lib/ovs-thread.c
@@ -674,7 +674,7 @@ count_cpu_cores(void)
static int cpu_cores;
ovs_mutex_lock(&cpu_cores_mutex);
- if (now - last_updated >= COUNT_CPU_UPDATE_TIME_MS) {
+ if (!last_updated || now - last_updated >= COUNT_CPU_UPDATE_TIME_MS) {
Making last_updated a static variable was a smart move so there is no
issue with it resetting to 0
This line grantees that the first time this code runs (presumably at
boot, or less than 10s, or any time after) the code block inside the if
statement will get executed
Thanks!
last_updated = now;
cpu_cores = count_cpu_cores__();
}
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev