Skip to content

Commit

Permalink
dpif-netdev: Fix Auto Load Balance debug log.
Browse files Browse the repository at this point in the history
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
a 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 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 to fix
logs.

Fixes: 46e04ec ("dpif-netdev: Calculate per numa variance.")
Reported-at: https://issues.redhat.com/browse/FDP-1145
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
Reviewed-by: David Marchand <david.marchand@redhat.com>
  • Loading branch information
kevintraynor committed Feb 14, 2025
1 parent becd379 commit 898ef68
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/dpif-netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -6296,9 +6296,6 @@ pmd_rebalance_dry_run(struct dp_netdev *dp)
struct sched_numa_list numa_list_cur;
struct sched_numa_list numa_list_est;
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.");

Expand All @@ -6314,9 +6311,14 @@ pmd_rebalance_dry_run(struct dp_netdev *dp)
/* Check if cross-numa polling, there is only one numa with PMDs. */
if (!sched_numa_list_cross_numa_polling(&numa_list_est) ||
sched_numa_list_count(&numa_list_est) == 1) {
struct sched_numa *numa_cur;

/* 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) {
Expand Down

0 comments on commit 898ef68

Please sign in to comment.