Skip to content

Commit

Permalink
tipc: replace name table service range array with rb tree
Browse files Browse the repository at this point in the history
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: Jon Maloy <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Jon Maloy authored and davem330 committed Apr 1, 2018
1 parent 24197ee commit 218527f
Show file tree
Hide file tree
Showing 6 changed files with 477 additions and 568 deletions.
1 change: 1 addition & 0 deletions net/tipc/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include <linux/etherdevice.h>
#include <net/netns/generic.h>
#include <linux/rhashtable.h>
#include <net/genetlink.h>

struct tipc_node;
struct tipc_bearer;
Expand Down
2 changes: 1 addition & 1 deletion net/tipc/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
int max_bulk = TIPC_MAX_PUBLICATIONS / (l->mtu / ITEM_SIZE);
int max_bulk = TIPC_MAX_PUBL / (l->mtu / ITEM_SIZE);

l->window = win;
l->backlog[TIPC_LOW_IMPORTANCE].limit = max_t(u16, 50, win);
Expand Down
Loading

0 comments on commit 218527f

Please sign in to comment.