From: Paolo Abeni <pabeni@redhat.com> Date: 2022-02-04 11:29:29
This series collects a couple of small optimizations for the GRO engine,
reducing slightly the number of cycles for dev_gro_receive().
The delta is within noise range in tput tests, but with big TCP coming
every cycle saved from the GRO engine will count - I hope ;)
v1 -> v2:
- a few cleanup suggested from Alexander(s)
- moved away the more controversial 3rd patch
Paolo Abeni (2):
net: gro: avoid re-computing truesize twice on recycle
net: gro: minor optimization for dev_gro_receive()
include/net/gro.h | 52 +++++++++++++++++++++++++----------------------
net/core/gro.c | 16 ++++-----------
2 files changed, 32 insertions(+), 36 deletions(-)
--
2.34.1
From: Paolo Abeni <pabeni@redhat.com> Date: 2022-02-04 11:29:29
After commit 5e10da5385d2 ("skbuff: allow 'slow_gro' for skb
carring sock reference") and commit af352460b465 ("net: fix GRO
skb truesize update") the truesize of the skb with stolen head is
properly updated by the GRO engine, we don't need anymore resetting
it at recycle time.
v1 -> v2:
- clarify the commit message (Alexander)
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
net/core/gro.c | 1 -
1 file changed, 1 deletion(-)
From: Paolo Abeni <pabeni@redhat.com> Date: 2022-02-04 11:29:33
While inspecting some perf report, I noticed that the compiler
emits suboptimal code for the napi CB initialization, fetching
and storing multiple times the memory for flags bitfield.
This is with gcc 10.3.1, but I observed the same with older compiler
versions.
We can help the compiler to do a nicer work clearing several
fields at once using an u32 alias. The generated code is quite
smaller, with the same number of conditional.
Before:
objdump -t net/core/gro.o | grep " F .text"
0000000000000bb0 l F .text 0000000000000357 dev_gro_receive
After:
0000000000000bb0 l F .text 000000000000033c dev_gro_receive
v1 -> v2:
- use struct_group (Alexander and Alex)
RFC -> v1:
- use __struct_group to delimit the zeroed area (Alexander)
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
include/net/gro.h | 52 +++++++++++++++++++++++++----------------------
net/core/gro.c | 15 ++++----------
2 files changed, 32 insertions(+), 35 deletions(-)
@@ -29,46 +29,50 @@ struct napi_gro_cb {/* Number of segments aggregated. */u16count;-/* Start offset for remote checksum offload */-u16gro_remcsum_start;+/* Used in ipv6_gro_receive() and foo-over-udp */+u16proto;/* jiffies when first packet was created/queued */unsignedlongage;-/* Used in ipv6_gro_receive() and foo-over-udp */-u16proto;+/* portion of the cb set to zero at every gro iteration */+struct_group(zeroed,++/* Start offset for remote checksum offload */+u16gro_remcsum_start;-/* This is non-zero if the packet may be of the same flow. */-u8same_flow:1;+/* This is non-zero if the packet may be of the same flow. */+u8same_flow:1;-/* Used in tunnel GRO receive */-u8encap_mark:1;+/* Used in tunnel GRO receive */+u8encap_mark:1;-/* GRO checksum is valid */-u8csum_valid:1;+/* GRO checksum is valid */+u8csum_valid:1;-/* Number of checksums via CHECKSUM_UNNECESSARY */-u8csum_cnt:3;+/* Number of checksums via CHECKSUM_UNNECESSARY */+u8csum_cnt:3;-/* Free the skb? */-u8free:2;+/* Free the skb? */+u8free:2;#define NAPI_GRO_FREE 1#define NAPI_GRO_FREE_STOLEN_HEAD 2-/* Used in foo-over-udp, set in udp[46]_gro_receive */-u8is_ipv6:1;+/* Used in foo-over-udp, set in udp[46]_gro_receive */+u8is_ipv6:1;-/* Used in GRE, set in fou/gue_gro_receive */-u8is_fou:1;+/* Used in GRE, set in fou/gue_gro_receive */+u8is_fou:1;-/* Used to determine if flush_id can be ignored */-u8is_atomic:1;+/* Used to determine if flush_id can be ignored */+u8is_atomic:1;-/* Number of gro_receive callbacks this packet already went through */-u8recursion_counter:4;+/* Number of gro_receive callbacks this packet already went through */+u8recursion_counter:4;-/* GRO is done by frag_list pointer chaining. */-u8is_flist:1;+/* GRO is done by frag_list pointer chaining. */+u8is_flist:1;+);/* used to support CHECKSUM_COMPLETE for tunneling protocols */__wsumcsum;
From: Paolo Abeni <pabeni@redhat.com> Date: 2022-02-04 11:34:12
On Fri, 2022-02-04 at 12:28 +0100, Paolo Abeni wrote:
This series collects a couple of small optimizations for the GRO engine,
reducing slightly the number of cycles for dev_gro_receive().
The delta is within noise range in tput tests, but with big TCP coming
every cycle saved from the GRO engine will count - I hope ;)
v1 -> v2:
- a few cleanup suggested from Alexander(s)
- moved away the more controversial 3rd patch
Paolo Abeni (2):
net: gro: avoid re-computing truesize twice on recycle
net: gro: minor optimization for dev_gro_receive()
include/net/gro.h | 52 +++++++++++++++++++++++++----------------------
net/core/gro.c | 16 ++++-----------
2 files changed, 32 insertions(+), 36 deletions(-)
This is really a v2. Please let me know if you prefer a formal repost.
Thanks!
Paolo
From: Alexander Lobakin <hidden> Date: 2022-02-04 12:18:13
From: Paolo Abeni <pabeni@redhat.com>
Date: Fri, 4 Feb 2022 12:28:35 +0100
This series collects a couple of small optimizations for the GRO engine,
reducing slightly the number of cycles for dev_gro_receive().
The delta is within noise range in tput tests, but with big TCP coming
every cycle saved from the GRO engine will count - I hope ;)
v1 -> v2:
- a few cleanup suggested from Alexander(s)
- moved away the more controversial 3rd patch
Paolo Abeni (2):
net: gro: avoid re-computing truesize twice on recycle
net: gro: minor optimization for dev_gro_receive()
Looks nice to me now, thanks!
For the series:
Reviewed-by: Alexander Lobakin <redacted>
From: Alexander Duyck <hidden> Date: 2022-02-04 15:56:00
On Fri, Feb 4, 2022 at 3:29 AM Paolo Abeni [off-list ref] wrote:
This series collects a couple of small optimizations for the GRO engine,
reducing slightly the number of cycles for dev_gro_receive().
The delta is within noise range in tput tests, but with big TCP coming
every cycle saved from the GRO engine will count - I hope ;)
v1 -> v2:
- a few cleanup suggested from Alexander(s)
- moved away the more controversial 3rd patch
Paolo Abeni (2):
net: gro: avoid re-computing truesize twice on recycle
net: gro: minor optimization for dev_gro_receive()
include/net/gro.h | 52 +++++++++++++++++++++++++----------------------
net/core/gro.c | 16 ++++-----------
2 files changed, 32 insertions(+), 36 deletions(-)
This addresses the concern I had.
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
From: Eric Dumazet <edumazet@google.com> Date: 2022-02-04 16:34:50
On Fri, Feb 4, 2022 at 3:29 AM Paolo Abeni [off-list ref] wrote:
After commit 5e10da5385d2 ("skbuff: allow 'slow_gro' for skb
carring sock reference") and commit af352460b465 ("net: fix GRO
skb truesize update") the truesize of the skb with stolen head is
properly updated by the GRO engine, we don't need anymore resetting
it at recycle time.
v1 -> v2:
- clarify the commit message (Alexander)
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
From: David Miller <davem@davemloft.net> Date: 2022-02-05 09:52:02
From: Paolo Abeni <pabeni@redhat.com>
Date: Fri, 04 Feb 2022 12:34:03 +0100
On Fri, 2022-02-04 at 12:28 +0100, Paolo Abeni wrote:
quoted
This series collects a couple of small optimizations for the GRO engine,
reducing slightly the number of cycles for dev_gro_receive().
The delta is within noise range in tput tests, but with big TCP coming
every cycle saved from the GRO engine will count - I hope ;)
v1 -> v2:
- a few cleanup suggested from Alexander(s)
- moved away the more controversial 3rd patch
Paolo Abeni (2):
net: gro: avoid re-computing truesize twice on recycle
net: gro: minor optimization for dev_gro_receive()
include/net/gro.h | 52 +++++++++++++++++++++++++----------------------
net/core/gro.c | 16 ++++-----------
2 files changed, 32 insertions(+), 36 deletions(-)
This is really a v2. Please let me know if you prefer a formal repost.
Hello:
This series was applied to netdev/net-next.git (master)
by David S. Miller [off-list ref]:
On Fri, 4 Feb 2022 12:28:35 +0100 you wrote:
This series collects a couple of small optimizations for the GRO engine,
reducing slightly the number of cycles for dev_gro_receive().
The delta is within noise range in tput tests, but with big TCP coming
every cycle saved from the GRO engine will count - I hope ;)
v1 -> v2:
- a few cleanup suggested from Alexander(s)
- moved away the more controversial 3rd patch
[...]