summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Moreno <amorenoz@redhat.com>2023-03-27 10:40:11 +0200
committerIlya Maximets <i.maximets@ovn.org>2023-03-27 22:05:07 +0200
commitb354cee2e0a79a5fbe7140e964bb30e7c57919d6 (patch)
treee9d7ce4a8d29db9cdb92f29fd4176cd765f87a5b
parent79f936744916cfbc6952308d33012c994eb274de (diff)
downloadopenvswitch-b354cee2e0a79a5fbe7140e964bb30e7c57919d6.tar.gz
ovs-thread: Fix cpus not read for the first 10s.
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 <i.maximets@ovn.org> Acked-by: Mike Pattrick <mkp@redhat.com> Acked-by: Michael Santana <msantana@redhat.com> Signed-off-by: Adrian Moreno <amorenoz@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r--lib/ovs-thread.c2
1 files changed, 1 insertions, 1 deletions
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) {
last_updated = now;
cpu_cores = count_cpu_cores__();
}