[ovs-dev] [PATCH v3] dpif-netdev: add parameters to configure autolb

cfontain at redhat.com cfontain at redhat.com
Tue Aug 25 21:21:32 UTC 2020


From: Christophe Fontaine <cfontain at redhat.com>

ALB_ACCEPTABLE_IMPROVEMENT and ALB_PMD_LOAD_THRESHOLD default values
can be overriden with "pmd-auto-lb-acc-improvement" and "pmd-auto-lb-threshold".

Default values may not be suitable for all use cases, and we may want to
experiment a more (or less) aggressive rebalance, either on the threshold
(ie CPU usage which triggers a rebalance) or on the acceptable improvement
(ie if the new queue assignation will be applied or discarded).

$ ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-acc-improvement=20
$ ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-threshold=70

Signed-off-by: Christophe Fontaine <cfontain at redhat.com>
---
 .mailmap             |  1 +
 AUTHORS.rst          |  1 +
 NEWS                 |  2 ++
 lib/dpif-netdev.c    | 12 ++++++++++--
 vswitchd/vswitch.xml | 28 +++++++++++++++++++++++++++-
 5 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/.mailmap b/.mailmap
index 894062d48..cb90e15ee 100644
--- a/.mailmap
+++ b/.mailmap
@@ -28,6 +28,7 @@ Ben Pfaff <blp at ovn.org> <blp at nicira.com>
 Bruce Davie <bdavie at vmware.com> <bsd at nicira.com>
 Bruce Davie <bdavie at vmware.com> <bdavie at nicira.com>
 Chandra Sekhar Vejendla <csvejend at us.ibm.com>
+Christophe Fontaine <cfontain at redhat.com>
 Daniele Di Proietto <diproiettod at vmware.com> <daniele.di.proietto at gmail.com>
 Daniele Di Proietto <diproiettod at vmware.com> <ddiproietto at vmware.com>
 Ed Maste <emaste at freebsd.org> <emaste at adaranet.com>
diff --git a/AUTHORS.rst b/AUTHORS.rst
index 4d8eaa3bd..29e5f697d 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -88,6 +88,7 @@ Carlo Andreotti                    c.andreotti at m3s.it
 Casey Barker                       crbarker at google.com
 Chandra Sekhar Vejendla            csvejend at us.ibm.com
 Christoph Jaeger                   cj at linux.com
+Christophe Fontaine                cfontain at redhat.com
 Chris Wright                       chrisw at sous-sol.org
 Chuck Short                        zulcss at ubuntu.com
 Ciara Loftus                       ciara.loftus at intel.com
diff --git a/NEWS b/NEWS
index 2f67d5047..1e7ef2b50 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
 Post-v2.14.0
 ---------------------
+   - DPDK:
+     * Add parameters to configure auto load balance behaviour.
 
 
 v2.14.0 - 17 Aug 2020
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 02df8f11e..b981706b5 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -300,6 +300,8 @@ struct pmd_auto_lb {
     bool is_enabled;            /* Current status of Auto load balancing. */
     uint64_t rebalance_intvl;
     uint64_t rebalance_poll_timer;
+    uint64_t rebalance_acc_improvement;
+    uint64_t rebalance_threshold;
 };
 
 /* Datapath based on the network device interface from netdev.h.
@@ -4346,6 +4348,12 @@ dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config)
         pmd_alb->rebalance_intvl = rebalance_intvl;
     }
 
+    pmd_alb->rebalance_acc_improvement = smap_get_int(other_config,
+                "pmd-auto-lb-acc-improvement", ALB_ACCEPTABLE_IMPROVEMENT);
+
+    pmd_alb->rebalance_threshold = smap_get_int(other_config,
+                "pmd-auto-lb-threshold", ALB_PMD_LOAD_THRESHOLD);
+
     set_pmd_auto_lb(dp);
     return 0;
 }
@@ -5674,7 +5682,7 @@ pmd_rebalance_dry_run(struct dp_netdev *dp)
             improvement =
                 ((curr_variance - new_variance) * 100) / curr_variance;
         }
-        if (improvement < ALB_ACCEPTABLE_IMPROVEMENT) {
+        if (improvement < dp->pmd_alb.rebalance_acc_improvement) {
             ret = false;
         }
     }
@@ -8724,7 +8732,7 @@ dp_netdev_pmd_try_optimize(struct dp_netdev_pmd_thread *pmd,
                 pmd_load = ((tot_proc * 100) / (tot_idle + tot_proc));
             }
 
-            if (pmd_load >= ALB_PMD_LOAD_THRESHOLD) {
+            if (pmd_load >= pmd_alb->rebalance_threshold) {
                 atomic_count_inc(&pmd->pmd_overloaded);
             } else {
                 atomic_count_set(&pmd->pmd_overloaded, 0);
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 81c84927f..53f9be591 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -654,7 +654,7 @@
         <p>
          Configures PMD Auto Load Balancing that allows automatic assignment of
          RX queues to PMDs if any of PMDs is overloaded (i.e. processing cycles
-         > 95%).
+         > other_config:pmd-auto-lb-threshold).
         </p>
         <p>
          It uses current scheme of cycle based assignment of RX queues that
@@ -690,6 +690,32 @@
          once in few hours or a day or a week.
         </p>
       </column>
+      <column name="other_config" key="pmd-auto-lb-threshold"
+              type='{"type": "integer",
+                     "minInteger": 0, "maxInteger": 100}'>
+        <p>
+         Specifies the threshold defining when a PMD is overloaded.
+         When this threshold is reached, it will trigger a request to
+         rebalance the different queues between the non-pinned pmds.
+        </p>
+        <p>
+         The default value is <code>95</code>.
+        </p>
+      </column>
+      <column name="other_config" key="pmd-auto-lb-acc-improvement"
+              type='{"type": "integer",
+                     "minInteger": 0, "maxInteger": 100}'>
+        <p>
+         When an auto load balance iteration is requested, this value
+         defines if the new queue assignation will be applied: comparing
+         the current queue assignation and the new one, the new assignation
+         will be applied only if the improvement of CPU usage is above
+         this value.
+        </p>
+        <p>
+         The default value is <code>25</code>.
+        </p>
+      </column>
       <column name="other_config" key="userspace-tso-enable"
               type='{"type": "boolean"}'>
         <p>
-- 
2.24.3 (Apple Git-128)



More information about the dev mailing list