summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2024-02-09 17:18:22 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2024-02-09 17:18:22 +0200
commit1fce318efccbf4ce9286ea1e868a7a6a5301ab06 (patch)
treee265615867625773ac249bd4afe77e250f4b2759
parentb7987eca200adaa3e90b7681ccd1c8e040d48792 (diff)
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 <donatas@opensourcerouting.org>
-rw-r--r--bgpd/bgp_advertise.h6
1 files 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);