diff options
author | Donald Sharp <sharpd@nvidia.com> | 2023-04-19 14:13:18 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2023-06-26 20:59:21 +0200 |
commit | 161972c9fe108ffe3de851a537d9b34efeb09e31 (patch) | |
tree | 6de17e2202d18969ee4aae4c85ecaccdc89c4f89 /bgpd/bgp_zebra.c | |
parent | Merge pull request #13804 from LabNConsulting/aceelindem/ospf6d-config-callbacks (diff) | |
download | frr-161972c9fe108ffe3de851a537d9b34efeb09e31.tar.xz frr-161972c9fe108ffe3de851a537d9b34efeb09e31.zip |
*: Rearrange vrf_bitmap_X api to reduce memory footprint
When running all daemons with config for most of them, FRR has
sharpd@janelle:~/frr$ vtysh -c "show debug hashtable" | grep "VRF BIT HASH" | wc -l
3570
3570 hashes for bitmaps associated with the vrf. This is a very
large number of hashes. Let's do two things:
a) Reduce the created size of the actually created hashes to 2
instead of 32.
b) Delay generation of the hash *until* a set operation happens.
As that no hash directly implies a unset value if/when checked.
This reduces the number of hashes to 61 in my setup for normal
operation.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd/bgp_zebra.c')
-rw-r--r-- | bgpd/bgp_zebra.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 3e1fdc628..fed23fc9c 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1911,7 +1911,7 @@ int bgp_redistribute_set(struct bgp *bgp, afi_t afi, int type, redist_add_instance(&zclient->mi_redist[afi][type], instance); } else { - if (vrf_bitmap_check(zclient->redist[afi][type], bgp->vrf_id)) + if (vrf_bitmap_check(&zclient->redist[afi][type], bgp->vrf_id)) return CMD_WARNING; #ifdef ENABLE_BGP_VNC @@ -1921,7 +1921,7 @@ int bgp_redistribute_set(struct bgp *bgp, afi_t afi, int type, } #endif - vrf_bitmap_set(zclient->redist[afi][type], bgp->vrf_id); + vrf_bitmap_set(&zclient->redist[afi][type], bgp->vrf_id); } /* @@ -2042,9 +2042,9 @@ int bgp_redistribute_unreg(struct bgp *bgp, afi_t afi, int type, return CMD_WARNING; redist_del_instance(&zclient->mi_redist[afi][type], instance); } else { - if (!vrf_bitmap_check(zclient->redist[afi][type], bgp->vrf_id)) + if (!vrf_bitmap_check(&zclient->redist[afi][type], bgp->vrf_id)) return CMD_WARNING; - vrf_bitmap_unset(zclient->redist[afi][type], bgp->vrf_id); + vrf_bitmap_unset(&zclient->redist[afi][type], bgp->vrf_id); } if (bgp_install_info_to_zebra(bgp)) { |