Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 218527fe authored by Jon Maloy's avatar Jon Maloy Committed by David S. Miller
Browse files

tipc: replace name table service range array with rb tree



The current design of the binding table has an unnecessary memory
consuming and complex data structure. It aggregates the service range
items into an array, which is expanded by a factor two every time it
becomes too small to hold a new item. Furthermore, the arrays never
shrink when the number of ranges diminishes.

We now replace this array with an RB tree that is holding the range
items as tree nodes, each range directly holding a list of bindings.

This, along with a few name changes, improves both readability and
volume of the code, as well as reducing memory consumption and hopefully
improving cache hit rate.

Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 24197ee2
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -58,6 +58,7 @@
#include <linux/etherdevice.h>
#include <linux/etherdevice.h>
#include <net/netns/generic.h>
#include <net/netns/generic.h>
#include <linux/rhashtable.h>
#include <linux/rhashtable.h>
#include <net/genetlink.h>


struct tipc_node;
struct tipc_node;
struct tipc_bearer;
struct tipc_bearer;
+1 −1
Original line number Original line Diff line number Diff line
@@ -1810,7 +1810,7 @@ int tipc_link_bc_nack_rcv(struct tipc_link *l, struct sk_buff *skb,


void tipc_link_set_queue_limits(struct tipc_link *l, u32 win)
void tipc_link_set_queue_limits(struct tipc_link *l, u32 win)
{
{
	int max_bulk = TIPC_MAX_PUBLICATIONS / (l->mtu / ITEM_SIZE);
	int max_bulk = TIPC_MAX_PUBL / (l->mtu / ITEM_SIZE);


	l->window = win;
	l->window = win;
	l->backlog[TIPC_LOW_IMPORTANCE].limit      = max_t(u16, 50, win);
	l->backlog[TIPC_LOW_IMPORTANCE].limit      = max_t(u16, 50, win);
+470 −562

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Original line Diff line number Diff line
@@ -97,7 +97,7 @@ struct publication {
 * @local_publ_count: number of publications issued by this node
 * @local_publ_count: number of publications issued by this node
 */
 */
struct name_table {
struct name_table {
	struct hlist_head seq_hlist[TIPC_NAMETBL_SIZE];
	struct hlist_head services[TIPC_NAMETBL_SIZE];
	struct list_head node_scope;
	struct list_head node_scope;
	struct list_head cluster_scope;
	struct list_head cluster_scope;
	u32 local_publ_count;
	u32 local_publ_count;
+2 −2
Original line number Original line Diff line number Diff line
@@ -324,12 +324,12 @@ static void tipc_node_write_unlock(struct tipc_node *n)
	if (flags & TIPC_NOTIFY_LINK_UP) {
	if (flags & TIPC_NOTIFY_LINK_UP) {
		tipc_mon_peer_up(net, addr, bearer_id);
		tipc_mon_peer_up(net, addr, bearer_id);
		tipc_nametbl_publish(net, TIPC_LINK_STATE, addr, addr,
		tipc_nametbl_publish(net, TIPC_LINK_STATE, addr, addr,
				     TIPC_NODE_SCOPE, link_id, addr);
				     TIPC_NODE_SCOPE, link_id, link_id);
	}
	}
	if (flags & TIPC_NOTIFY_LINK_DOWN) {
	if (flags & TIPC_NOTIFY_LINK_DOWN) {
		tipc_mon_peer_down(net, addr, bearer_id);
		tipc_mon_peer_down(net, addr, bearer_id);
		tipc_nametbl_withdraw(net, TIPC_LINK_STATE, addr,
		tipc_nametbl_withdraw(net, TIPC_LINK_STATE, addr,
				      link_id, addr);
				      link_id, link_id);
	}
	}
}
}


Loading