diff mbox series

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

Message ID 32227465e3e15ff243439ed6a75d8f3be4ce24cd.1631094144.git.grive@u256.net
State Accepted
Commit 528a8ab6270bcf8e5980528c4ff19fbfb86bee22
Headers show
Series dpif-netdev: Parallel offload processing | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Gaetan Rivet Sept. 8, 2021, 9:47 a.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

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index c4672e6e5..c3d211858 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2544,14 +2544,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