From 1fce318efccbf4ce9286ea1e868a7a6a5301ab06 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Fri, 9 Feb 2024 17:18:22 +0200 Subject: [PATCH] bgpd: Optimize memory for bgp_adj_out struct ``` struct bgp_adj_out { struct rb_entry adj_entry; /* 0 32 */ /* XXX last struct has 4 bytes of padding */ struct update_subgroup * subgroup; /* 32 8 */ struct { struct bgp_adj_out * tqe_next; /* 40 8 */ struct bgp_adj_out * * tqe_prev; /* 48 8 */ } subgrp_adj_train; /* 40 16 */ struct bgp_dest * dest; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ uint32_t addpath_tx_id; /* 64 4 */ uint32_t attr_hash; /* 68 4 */ struct attr * attr; /* 72 8 */ struct bgp_advertise * adv; /* 80 8 */ /* size: 88, cachelines: 2, members: 8 */ /* paddings: 1, sum paddings: 4 */ /* last cacheline: 24 bytes */ }; /* saved 8 bytes! */ ``` Signed-off-by: Donatas Abraitis --- bgpd/bgp_advertise.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bgpd/bgp_advertise.h b/bgpd/bgp_advertise.h index 7c3b23ab54..49821061b1 100644 --- a/bgpd/bgp_advertise.h +++ b/bgpd/bgp_advertise.h @@ -69,14 +69,14 @@ struct bgp_adj_out { uint32_t addpath_tx_id; + /* Attribute hash */ + uint32_t attr_hash; + /* Advertised attribute. */ struct attr *attr; /* Advertisement information. */ struct bgp_advertise *adv; - - /* Attribute hash */ - uint32_t attr_hash; }; RB_HEAD(bgp_adj_out_rb, bgp_adj_out);