Skip to content

Commit b8c7aec

Browse files
magnus-karlssonborkmann
authored andcommitted
xsk: Introduce padding between more ring pointers
Introduce one cache line worth of padding between the consumer pointer and the flags field as well as between the flags field and the start of the descriptors in all the lockless rings. This so that the x86 HW adjacency prefetcher will not prefetch the adjacent pointer/field when only one pointer/field is going to be used. This improves throughput performance for the l2fwd sample app with 1% on my machine with HW prefetching turned on in the BIOS. Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://lore.kernel.org/bpf/1605525167-14450-4-git-send-email-magnus.karlsson@gmail.com
1 parent f320460 commit b8c7aec

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/xdp/xsk_queue.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ struct xdp_ring {
1818
/* Hinder the adjacent cache prefetcher to prefetch the consumer
1919
* pointer if the producer pointer is touched and vice versa.
2020
*/
21-
u32 pad ____cacheline_aligned_in_smp;
21+
u32 pad1 ____cacheline_aligned_in_smp;
2222
u32 consumer ____cacheline_aligned_in_smp;
23+
u32 pad2 ____cacheline_aligned_in_smp;
2324
u32 flags;
25+
u32 pad3 ____cacheline_aligned_in_smp;
2426
};
2527

2628
/* Used for the RX and TX queues for packets */

0 commit comments

Comments
 (0)