summaryrefslogtreecommitdiff
path: root/ospfd/ospf_zebra.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-04-19 08:13:18 -0400
committerDonald Sharp <sharpd@nvidia.com>2023-06-26 14:59:21 -0400
commit161972c9fe108ffe3de851a537d9b34efeb09e31 (patch)
tree6de17e2202d18969ee4aae4c85ecaccdc89c4f89 /ospfd/ospf_zebra.c
parentdee79c33a425d264e53e0e5d0ad51b1bc13945d0 (diff)
*: 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 'ospfd/ospf_zebra.c')
-rw-r--r--ospfd/ospf_zebra.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 27d74cd4fc..339bb43566 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -814,16 +814,16 @@ int ospf_is_type_redistributed(struct ospf *ospf, int type,
unsigned short instance)
{
return (DEFAULT_ROUTE_TYPE(type)
- ? vrf_bitmap_check(zclient->default_information[AFI_IP],
- ospf->vrf_id)
- : ((instance
- && redist_check_instance(
+ ? vrf_bitmap_check(
+ &zclient->default_information[AFI_IP],
+ ospf->vrf_id)
+ : ((instance &&
+ redist_check_instance(
&zclient->mi_redist[AFI_IP][type],
- instance))
- || (!instance
- && vrf_bitmap_check(
- zclient->redist[AFI_IP][type],
- ospf->vrf_id))));
+ instance)) ||
+ (!instance &&
+ vrf_bitmap_check(&zclient->redist[AFI_IP][type],
+ ospf->vrf_id))));
}
int ospf_redistribute_update(struct ospf *ospf, struct ospf_redist *red,