-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some more memory optimizations #15346
Merged
donaldsharp
merged 4 commits into
FRRouting:master
from
opensourcerouting:fix/memory_optimizations
Feb 12, 2024
Merged
Some more memory optimizations #15346
donaldsharp
merged 4 commits into
FRRouting:master
from
opensourcerouting:fix/memory_optimizations
Feb 12, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` 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 <[email protected]>
``` struct ecommunity { long unsigned int refcnt; /* 0 8 */ uint8_t unit_size; /* 8 1 */ _Bool disable_ieee_floating; /* 9 1 */ /* XXX 2 bytes hole, try to pack */ uint32_t size; /* 12 4 */ uint8_t * val; /* 16 8 */ char * str; /* 24 8 */ /* size: 32, cachelines: 1, members: 6 */ /* sum members: 30, holes: 1, sum holes: 2 */ /* last cacheline: 32 bytes */ }; /* saved 8 bytes! */ ``` Signed-off-by: Donatas Abraitis <[email protected]>
``` struct bgp_nexthop_cache { afi_t afi; /* 0 4 */ ifindex_t ifindex_ipv6_ll; /* 4 4 */ struct bgp_nexthop_cache_item entry; /* 8 32 */ uint32_t metric; /* 40 4 */ uint8_t nexthop_num; /* 44 1 */ _Bool is_evpn_gwip_nexthop; /* 45 1 */ uint16_t change_flags; /* 46 2 */ struct nexthop * nexthop; /* 48 8 */ time_t last_update; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ uint16_t flags; /* 64 2 */ /* XXX 2 bytes hole, try to pack */ uint32_t srte_color; /* 68 4 */ struct bgp_nexthop_cache_head * tree; /* 72 8 */ struct prefix prefix __attribute__((__aligned__(8))); /* 80 56 */ /* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */ void * nht_info; /* 136 8 */ struct path_list paths; /* 144 8 */ unsigned int path_count; /* 152 4 */ /* XXX 4 bytes hole, try to pack */ struct bgp * bgp; /* 160 8 */ /* size: 168, cachelines: 3, members: 17 */ /* sum members: 162, holes: 2, sum holes: 6 */ /* forced alignments: 1 */ /* last cacheline: 40 bytes */ } __attribute__((__aligned__(8))); /* saved 16 bytes! */ ``` Signed-off-by: Donatas Abraitis <[email protected]>
``` struct peer_connection { struct peer * peer; /* 0 8 */ enum bgp_fsm_status status; /* 8 4 */ enum bgp_fsm_status ostatus; /* 12 4 */ int fd; /* 16 4 */ uint32_t thread_flags; /* 20 4 */ pthread_mutex_t io_mtx; /* 24 40 */ /* --- cacheline 1 boundary (64 bytes) --- */ struct stream_fifo * ibuf; /* 64 8 */ struct stream_fifo * obuf; /* 72 8 */ struct ringbuf * ibuf_work; /* 80 8 */ struct event * t_read; /* 88 8 */ struct event * t_write; /* 96 8 */ struct event * t_connect; /* 104 8 */ struct event * t_delayopen; /* 112 8 */ struct event * t_start; /* 120 8 */ /* --- cacheline 2 boundary (128 bytes) --- */ struct event * t_holdtime; /* 128 8 */ struct event * t_connect_check_r; /* 136 8 */ struct event * t_connect_check_w; /* 144 8 */ struct event * t_gr_restart; /* 152 8 */ struct event * t_gr_stale; /* 160 8 */ struct event * t_generate_updgrp_packets; /* 168 8 */ struct event * t_pmax_restart; /* 176 8 */ struct event * t_routeadv; /* 184 8 */ /* --- cacheline 3 boundary (192 bytes) --- */ struct event * t_process_packet; /* 192 8 */ struct event * t_process_packet_error; /* 200 8 */ union sockunion su; /* 208 128 */ /* size: 336, cachelines: 6, members: 25 */ /* last cacheline: 16 bytes */ }; /* saved 8 bytes! */ ``` Signed-off-by: Donatas Abraitis <[email protected]>
LGTM. I'll get in once CI finishes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.