From 161972c9fe108ffe3de851a537d9b34efeb09e31 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 19 Apr 2023 08:13:18 -0400 Subject: *: 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 --- eigrpd/eigrp_northbound.c | 2 +- eigrpd/eigrp_zebra.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'eigrpd') diff --git a/eigrpd/eigrp_northbound.c b/eigrpd/eigrp_northbound.c index 74a4dcb85..f50abb7e4 100644 --- a/eigrpd/eigrp_northbound.c +++ b/eigrpd/eigrp_northbound.c @@ -724,7 +724,7 @@ static int eigrpd_instance_redistribute_create(struct nb_cb_create_args *args) else vrfid = VRF_DEFAULT; - if (vrf_bitmap_check(zclient->redist[AFI_IP][proto], vrfid)) + if (vrf_bitmap_check(&zclient->redist[AFI_IP][proto], vrfid)) return NB_ERR_INCONSISTENCY; break; case NB_EV_PREPARE: diff --git a/eigrpd/eigrp_zebra.c b/eigrpd/eigrp_zebra.c index 94c2bcab7..a5cecb9c1 100644 --- a/eigrpd/eigrp_zebra.c +++ b/eigrpd/eigrp_zebra.c @@ -249,9 +249,9 @@ void eigrp_zebra_route_delete(struct eigrp *eigrp, struct prefix *p) static int eigrp_is_type_redistributed(int type, vrf_id_t vrf_id) { return ((DEFAULT_ROUTE_TYPE(type)) - ? vrf_bitmap_check(zclient->default_information[AFI_IP], - vrf_id) - : vrf_bitmap_check(zclient->redist[AFI_IP][type], + ? vrf_bitmap_check( + &zclient->default_information[AFI_IP], vrf_id) + : vrf_bitmap_check(&zclient->redist[AFI_IP][type], vrf_id)); } -- cgit v1.2.3