diff mbox series

[ovs-dev,v4,16/27] dpif-netdev: Postpone flow offload item freeing

Message ID e40956162cb5d403adbacd72522bc2ae1df0d966.1623234822.git.grive@u256.net
State New
Headers show
Series [ovs-dev,v4,01/27] ovs-thread: Fix barrier use-after-free | expand

Commit Message

Gaetan Rivet June 9, 2021, 1:09 p.m. UTC
Profiling the HW offload thread, the flow offload freeing takes
approximatively 25% of the time. Most of this time is spent waiting on
the futex used by the libc free(), as it triggers a syscall and
reschedule the thread.

Avoid the syscall and its expensive context switch. Batch the offload
messages freeing using the RCU.

Signed-off-by: Gaetan Rivet <grive@u256.net>
Reviewed-by: Eli Britstein <elibr@nvidia.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
 lib/dpif-netdev.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
diff mbox series


diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index e403e461a..75b289904 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2625,14 +2625,19 @@  dp_netdev_alloc_flow_offload(struct dp_netdev_pmd_thread *pmd,
     return offload;
+static void
+dp_netdev_free_flow_offload__(struct dp_offload_thread_item *offload)
+    free(offload->actions);
+    free(offload);
 static void
 dp_netdev_free_flow_offload(struct dp_offload_thread_item *offload)
-    free(offload->actions);
-    free(offload);
+    ovsrcu_postpone(dp_netdev_free_flow_offload__, offload);
 static void