diff mbox series

[ovs-dev] dp-packet: prefetch the next packet when cloning a batch.

Message ID 20200207120113.147165-1-fbl@sysclose.org
State Accepted
Headers show
Series [ovs-dev] dp-packet: prefetch the next packet when cloning a batch. | expand

Commit Message

Flavio Leitner Feb. 7, 2020, 12:01 p.m. UTC
There is a cache miss when accessing mbuf->data_off while cloning
a batch and using prefetch improved the throughput by ~2.3%.

Before: 13709416.30 pps
 After: 14031475.80 pps

Fixes: d48771848560 ("dp-packet: preserve headroom when cloning a pkt batch")
Signed-off-by: Flavio Leitner <fbl@sysclose.org>
---
 lib/dp-packet.h | 4 ++++
 1 file changed, 4 insertions(+)

* This patch applies for branch-2.13 as well.

Comments

0-day Robot Feb. 7, 2020, 12:58 p.m. UTC | #1
Bleep bloop.  Greetings Flavio Leitner, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Line lacks whitespace around operator
#27 FILE: lib/dp-packet.h:1052:
            OVS_PREFETCH(src->packets[i+1]);

Lines checked: 35, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
Ben Pfaff Feb. 10, 2020, 5:42 p.m. UTC | #2
On Fri, Feb 07, 2020 at 09:01:13AM -0300, Flavio Leitner wrote:
> There is a cache miss when accessing mbuf->data_off while cloning
> a batch and using prefetch improved the throughput by ~2.3%.
> 
> Before: 13709416.30 pps
>  After: 14031475.80 pps
> 
> Fixes: d48771848560 ("dp-packet: preserve headroom when cloning a pkt batch")
> Signed-off-by: Flavio Leitner <fbl@sysclose.org>
> ---
>  lib/dp-packet.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> * This patch applies for branch-2.13 as well.

Applied to master and branch-2.13.
diff mbox series

Patch

diff --git a/lib/dp-packet.h b/lib/dp-packet.h
index 69ae5dfac..387f51261 100644
--- a/lib/dp-packet.h
+++ b/lib/dp-packet.h
@@ -1046,6 +1046,10 @@  dp_packet_batch_clone(struct dp_packet_batch *dst,
 
     dp_packet_batch_init(dst);
     DP_PACKET_BATCH_FOR_EACH (i, packet, src) {
+        if ((i + 1) < dp_packet_batch_size(src)) {
+            OVS_PREFETCH(src->packets[i+1]);
+        }
+
         uint32_t headroom = dp_packet_headroom(packet);
         struct dp_packet *pkt_clone;