From 46e9eeeb328c3ca0fc00a6a9716185832443656c Mon Sep 17 00:00:00 2001 From: Kevin Traynor Date: Tue, 11 Feb 2025 18:03:09 +0000 Subject: [PATCH] dpif-netdev: Fix Auto Load Balance debug log. In the case where there is a NUMA node that has a zero variance improvement, the log will report it's variance improvement as value for the previous NUMA node with a non-zero variance improvement. For example in an artificial case: |dpif_netdev|DBG|Numa node 1. Current variance 1000 Estimated variance 0. Variance improvement 100%. ^^^ correct value |dpif_netdev|DBG|Numa node 0. Current variance 0 Estimated variance 0. Variance improvement 100%. ^^^ incorrect value for Numa 0, value from Numa 1 This is caused by not resetting the improvement variable between loops. This is a debug log reporting issue only, non-zero variance improvement will still trigger rebalance where appropriate. Move improvement and other variables into the loop code block. Fixes: 58fed7e8d8e8 ("dpif-netdev: Make PMD auto load balance use common rxq scheduling.") Reported-at: https://issues.redhat.com/browse/FDP-1145 Signed-off-by: Kevin Traynor --- lib/dpif-netdev.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index b572fab23de..d51d4d540e7 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -6518,10 +6518,8 @@ pmd_rebalance_dry_run(struct dp_netdev *dp) { struct sched_numa_list numa_list_cur; struct sched_numa_list numa_list_est; + struct sched_numa *numa_cur; bool thresh_met = false; - uint64_t current_var, estimate_var; - struct sched_numa *numa_cur, *numa_est; - uint64_t improvement = 0; VLOG_DBG("PMD auto load balance performing dry run."); @@ -6540,6 +6538,10 @@ pmd_rebalance_dry_run(struct dp_netdev *dp) /* Calculate variances. */ HMAP_FOR_EACH (numa_cur, node, &numa_list_cur.numas) { + uint64_t current_var, estimate_var; + struct sched_numa *numa_est; + uint64_t improvement = 0; + numa_est = sched_numa_list_lookup(&numa_list_est, numa_cur->numa_id); if (!numa_est) {