Skip to content

Commit 8420c79

Browse files
committed
peer: put frequently used members above cache lines
The is_dead boolean is checked for every single packet, while the internal_id member is used basically only for pr_debug messages. So it makes sense to hoist up is_dead into some space formerly unused by a struct hole, while demoting internal_api to below the lowest struct cache line. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
1 parent bb0ed3f commit 8420c79

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/peer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct wg_peer {
3939
struct crypt_queue tx_queue, rx_queue;
4040
struct sk_buff_head staged_packet_queue;
4141
int serial_work_cpu;
42+
bool is_dead;
4243
struct noise_keypairs keypairs;
4344
struct endpoint endpoint;
4445
struct dst_cache endpoint_cache;
@@ -61,9 +62,8 @@ struct wg_peer {
6162
struct rcu_head rcu;
6263
struct list_head peer_list;
6364
struct list_head allowedips_list;
64-
u64 internal_id;
6565
struct napi_struct napi;
66-
bool is_dead;
66+
u64 internal_id;
6767
};
6868

6969
struct wg_peer *wg_peer_create(struct wg_device *wg,

0 commit comments

Comments
 (0)