diff mbox series

[ovs-dev,v2] flow: Read recirculation depth once for whole batch in miniflow_extract

Message ID c0b99b4b9be6c290a6aa3cb00049fac4ebfac5d8.1618390390.git.bnemeth@redhat.com
State Superseded
Headers show
Series [ovs-dev,v2] flow: Read recirculation depth once for whole batch in miniflow_extract | expand

Commit Message

Balazs Nemeth April 14, 2021, 8:55 a.m. UTC
The call to recirc_depth_get involves accessing a TLS value which is
slower than accessing the stack.

Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
---
 lib/dpif-netdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Gaƫtan Rivet April 14, 2021, 4:36 p.m. UTC | #1
On Wed, Apr 14, 2021, at 10:55, Balazs Nemeth wrote:
> The call to recirc_depth_get involves accessing a TLS value which is
> slower than accessing the stack.
> 
> Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
> ---
>  lib/dpif-netdev.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index afe4d6c4c..525bec913 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -7095,6 +7095,7 @@ dfc_processing(struct dp_netdev_pmd_thread *pmd,
>      struct dp_packet *packet;
>      const size_t cnt = dp_packet_batch_size(packets_);
>      uint32_t cur_min = pmd->ctx.emc_insert_min;
> +    const uint32_t recirc_depth = *recirc_depth_get();
>      int i;
>      uint16_t tcp_flags;
>      bool smc_enable_db;
> @@ -7127,7 +7128,7 @@ dfc_processing(struct dp_netdev_pmd_thread *pmd,
>              pkt_metadata_init(&packet->md, port_no);
>          }
>  
> -        if ((*recirc_depth_get() == 0) &&
> +        if (recirc_depth == 0 &&
>              dp_packet_has_flow_mark(packet, &mark)) {
>              flow = mark_to_flow_find(pmd, mark);
>              if (OVS_LIKELY(flow)) {
> -- 
> 2.30.2
> 
> 

Thanks!

Acked-by: Gaetan Rivet <grive@u256.net>
Paolo Valerio May 5, 2021, 9:39 p.m. UTC | #2
Balazs Nemeth <bnemeth@redhat.com> writes:

> The call to recirc_depth_get involves accessing a TLS value which is
> slower than accessing the stack.
>
> Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
> ---

LGTM,

Acked-by: Paolo Valerio <pvalerio@redhat.com>
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index afe4d6c4c..525bec913 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -7095,6 +7095,7 @@  dfc_processing(struct dp_netdev_pmd_thread *pmd,
     struct dp_packet *packet;
     const size_t cnt = dp_packet_batch_size(packets_);
     uint32_t cur_min = pmd->ctx.emc_insert_min;
+    const uint32_t recirc_depth = *recirc_depth_get();
     int i;
     uint16_t tcp_flags;
     bool smc_enable_db;
@@ -7127,7 +7128,7 @@  dfc_processing(struct dp_netdev_pmd_thread *pmd,
             pkt_metadata_init(&packet->md, port_no);
         }
 
-        if ((*recirc_depth_get() == 0) &&
+        if (recirc_depth == 0 &&
             dp_packet_has_flow_mark(packet, &mark)) {
             flow = mark_to_flow_find(pmd, mark);
             if (OVS_LIKELY(flow)) {