Skip to content

Initialize flowi4 objects more efficiently.

David Miller netdev 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7net: Add helper flowi4_init_output().include/net/flow.h+21 -00 replies
2/7ipv4: Use flowi4_init_output() in net/route.hinclude/net/route.h+24 -360 replies
3/7ipv4: Use flowi4_init_output() in inet_connection_sock.cnet/ipv4/inet_connection_sock.c+6 -120 replies
4/7ipv4: Use flowi4_init_output() in ip_send_reply()net/ipv4/ip_output.c+8 -100 replies
5/7ipv4: Use flowi4_init_output() in raw_sendmsg()net/ipv4/raw.c+7 -110 replies
6/7ipv4: Use flowi4_init_output() in cookie_v4_check()net/ipv4/syncookies.c+7 -110 replies
7/7ipv4: Use flowi4_init_output() in udp_sendmsg()net/ipv4/udp.c+6 -120 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/7] Initialize flowi4 objects more efficiently.

When you do an initialization of an on-stack object such as:

	struct foo x = { .member1 = bar, .member2 = baz };

GCC will emit a memset of the object, then fill in the parameters you specify explicitly.

When the majority of the structure is being set explicitly, the memset is basically unnecessary overhead. Emitting explicit stores to fill in the zeros would be much cheaper, as well as avoid the function call to memset.

Fix this for the cases which initialize most of the flowi4 object.

I therefore left alone cases such as:

	struct flowi4 fl4 = { .daddr = daddr };

Since not only would any gains be minimal, we'd get code bloat and much of such cases are also in the slow paths.