zebra: Reorg struct route_entry
to have important bits first
#15309
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.
The
struct route_entry
had items that were almost never used at the front of the data structure resulting in items that would be loaded first into memory that were never used. Let's reorg a tiny bit and put all the frequently used items in the first cache line. I'm sure people will notice .000000001 speedupnew layout:
sharpd@eva /w/h/s/frr1 (reorg_route_entry)> /home/sharpd/pahole/build/pahole --reorganize --show_reorg_steps -C route_entry zebra/.libs/zebra struct route_entry {
struct re_list_item next; /* 0 8 /
struct nhg_hash_entry * nhe; / 8 8 /
uint32_t nhe_id; / 16 4 /
uint32_t nhe_installed_id; / 20 4 /
int type; / 24 4 /
vrf_id_t vrf_id; / 28 4 /
uint32_t table; / 32 4 /
uint32_t metric; / 36 4 /
uint32_t mtu; / 40 4 /
uint32_t nexthop_mtu; / 44 4 /
uint32_t flags; / 48 4 /
uint32_t status; / 52 4 /
uint32_t dplane_sequence; / 56 4 /
uint16_t instance; / 60 2 /
uint8_t distance; / 62 1 */
};