The list of PMDs is round robined through for the selection
when assigning an rxq to a PMD. The list is based on a
hash map, so there is no defined order.

It means that in cases where there is no traffic or
traffic patterns do not change, the same set of PMDs may get
assigned different rxqs for no reason other than how they are
stored in the hash map.

This can be easily changed to make the PMDs be assigned the
same rxqs by sorting the PMDs by core id after they are extracted
from the hmap.

Signed-off-by: Kevin Traynor <[email protected]>
---
 lib/dpif-netdev.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 99ac8cd8f..36dbde1f7 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -4981,4 +4981,28 @@ sched_numa_list_lookup(struct sched_numa_list 
*numa_list, int numa_id)
 }
 
+static int
+compare_sched_pmd_list(const void *a_, const void *b_)
+{
+    struct sched_pmd *a, *b;
+
+    a = (struct sched_pmd *) a_;
+    b = (struct sched_pmd *) b_;
+
+    return compare_poll_thread_list(&a->pmd, &b->pmd);
+}
+
+static void
+sort_numa_list_pmds(struct sched_numa_list *numa_list)
+{
+    struct sched_numa *numa;
+
+    HMAP_FOR_EACH (numa, node, &numa_list->numas) {
+        if (numa->n_pmds > 1) {
+            qsort(numa->pmds, numa->n_pmds, sizeof *numa->pmds,
+                  compare_sched_pmd_list);
+        }
+    }
+}
+
 /* Populate numas and pmds on those numas. */
 static void
@@ -5019,4 +5043,5 @@ sched_numa_list_populate(struct sched_numa_list 
*numa_list,
         numa->rr_idx_inc = true;
     }
+    sort_numa_list_pmds(numa_list);
 }
 
-- 
2.31.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to