Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mptcp: shrink mptcp_out_options struct

After the previous patch we can alias with a union several
fields in mptcp_out_options. Such struct is stack allocated and
memset() for each plain TCP out packet. Every saved byted counts.

Before:
pahole -EC mptcp_out_options
# ...
/* size: 136, cachelines: 3, members: 17 */

After:
pahole -EC mptcp_out_options
# ...
/* size: 56, cachelines: 1, members: 9 */

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Paolo Abeni and committed by
David S. Miller
d7b26908 1bff1e43

+17 -9
+17 -9
include/net/mptcp.h
··· 58 58 struct mptcp_out_options { 59 59 #if IS_ENABLED(CONFIG_MPTCP) 60 60 u16 suboptions; 61 - u64 sndr_key; 62 - u64 rcvr_key; 63 - u64 ahmac; 64 - struct mptcp_addr_info addr; 65 61 struct mptcp_rm_list rm_list; 66 62 u8 join_id; 67 63 u8 backup; ··· 65 69 reset_transient:1, 66 70 csum_reqd:1, 67 71 allow_join_id0:1; 68 - u32 nonce; 69 - u64 thmac; 70 - u32 token; 71 - u8 hmac[20]; 72 - struct mptcp_ext ext_copy; 72 + union { 73 + struct { 74 + u64 sndr_key; 75 + u64 rcvr_key; 76 + }; 77 + struct { 78 + struct mptcp_addr_info addr; 79 + u64 ahmac; 80 + }; 81 + struct mptcp_ext ext_copy; 82 + struct { 83 + u32 nonce; 84 + u32 token; 85 + u64 thmac; 86 + u8 hmac[20]; 87 + }; 88 + }; 73 89 #endif 74 90 }; 75 91