From 6e7f305e54f4828d58cb4b2e4c815d82a4cbe560 Mon Sep 17 00:00:00 2001 From: Yuqing Zhao Date: Mon, 31 Jul 2023 20:34:48 +0800 Subject: bgpd: Convert from struct bgp_node to struct bgp_dest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is based on @donaldsharp's work The current code base is the struct bgp_node data structure. The problem with this is that it creates a bunch of extra data per route_node. The table structure generates ‘holder’ nodes that are never going to receive bgp routes, and now the memory of those nodes is allocated as if they are a full bgp_node. After splitting up the bgp_node into bgp_dest and route_node, the memory of ‘holder’ node which does not have any bgp data will be allocated as the route_node, not the bgp_node, and the memory usage is reduced. The memory usage of BGP node will be reduced from 200B to 96B. The total memory usage optimization of this part is ~16.00%. Signed-off-by: Donald Sharp Signed-off-by: Yuqing Zhao --- lib/table.c | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/table.c') diff --git a/lib/table.c b/lib/table.c index 380852b54..3bf93894e 100644 --- a/lib/table.c +++ b/lib/table.c @@ -334,7 +334,6 @@ void route_node_delete(struct route_node *node) struct route_node *parent; assert(node->lock == 0); - assert(node->info == NULL); if (node->l_left && node->l_right) return; -- cgit v1.2.3