69e76b96e3c5c10821e24c4fed9037d4ea9a05d3
[openwrt/staging/981213.git] /
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: "Jason A. Donenfeld" <Jason@zx2c4.com>
3 Date: Mon, 22 Feb 2021 17:25:46 +0100
4 Subject: [PATCH] wireguard: peer: put frequently used members above cache
5 lines
6
7 commit 5a0598695634a6bb4126818902dd9140cd9df8b6 upstream.
8
9 The is_dead boolean is checked for every single packet, while the
10 internal_id member is used basically only for pr_debug messages. So it
11 makes sense to hoist up is_dead into some space formerly unused by a
12 struct hole, while demoting internal_api to below the lowest struct
13 cache line.
14
15 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
17 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
18 ---
19 drivers/net/wireguard/peer.h | 4 ++--
20 1 file changed, 2 insertions(+), 2 deletions(-)
21
22 --- a/drivers/net/wireguard/peer.h
23 +++ b/drivers/net/wireguard/peer.h
24 @@ -39,6 +39,7 @@ struct wg_peer {
25 struct crypt_queue tx_queue, rx_queue;
26 struct sk_buff_head staged_packet_queue;
27 int serial_work_cpu;
28 + bool is_dead;
29 struct noise_keypairs keypairs;
30 struct endpoint endpoint;
31 struct dst_cache endpoint_cache;
32 @@ -61,9 +62,8 @@ struct wg_peer {
33 struct rcu_head rcu;
34 struct list_head peer_list;
35 struct list_head allowedips_list;
36 - u64 internal_id;
37 struct napi_struct napi;
38 - bool is_dead;
39 + u64 internal_id;
40 };
41
42 struct wg_peer *wg_peer_create(struct wg_device *wg,