diff mbox series

[ovs-dev,v1,14/23] dpif-netdev: Postpone flow offload item freeing

Message ID 56e753427e9d8b07c0ca89a73c3a2192e4295eb7.1612968146.git.grive@u256.net
State New
Headers show
Series dpif-netdev: Parallel offload processing | expand

Commit Message

Gaƫtan Rivet Feb. 10, 2021, 3:34 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>
---
 lib/dpif-netdev.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 18e71446a..dc2828659 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2624,14 +2624,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)
 {
     dp_netdev_pmd_unref(offload->pmd);
     dp_netdev_flow_unref(offload->flow);
-
-    free(offload->actions);
-    free(offload);
+    ovsrcu_postpone(dp_netdev_free_flow_offload__, offload);
 }
 
 static void