You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
inetpeer: remove AVL implementation in favor of RB tree
As discussed in Faro during Netfilter Workshop 2017, RB trees can be used with RCU, using a seqlock. Note that net/rxrpc/conn_service.c is already using this. This patch converts inetpeer from AVL tree to RB tree, since it allows to remove private AVL implementation in favor of shared RB code. $ size net/ipv4/inetpeer.before net/ipv4/inetpeer.after text data bss dec hex filename 3195 40 128 3363 d23 net/ipv4/inetpeer.before 1562 24 0 1586 632 net/ipv4/inetpeer.after The same technique can be used to speed up net/netfilter/nft_set_rbtree.c (removing rwlock contention in fast path) Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
27eac47b00
commit
b145425f26
@@ -33,18 +33,12 @@ struct inetpeer_addr {
|
||||
};
|
||||
|
||||
struct inet_peer {
|
||||
/* group together avl_left,avl_right,v4daddr to speedup lookups */
|
||||
struct inet_peer __rcu *avl_left, *avl_right;
|
||||
struct rb_node rb_node;
|
||||
struct inetpeer_addr daddr;
|
||||
__u32 avl_height;
|
||||
|
||||
u32 metrics[RTAX_MAX];
|
||||
u32 rate_tokens; /* rate limiting for ICMP */
|
||||
unsigned long rate_last;
|
||||
union {
|
||||
struct list_head gc_list;
|
||||
struct rcu_head gc_rcu;
|
||||
};
|
||||
/*
|
||||
* Once inet_peer is queued for deletion (refcnt == 0), following field
|
||||
* is not available: rid
|
||||
@@ -55,7 +49,6 @@ struct inet_peer {
|
||||
atomic_t rid; /* Frag reception counter */
|
||||
};
|
||||
struct rcu_head rcu;
|
||||
struct inet_peer *gc_next;
|
||||
};
|
||||
|
||||
/* following fields might be frequently dirtied */
|
||||
@@ -64,7 +57,7 @@ struct inet_peer {
|
||||
};
|
||||
|
||||
struct inet_peer_base {
|
||||
struct inet_peer __rcu *root;
|
||||
struct rb_root rb_root;
|
||||
seqlock_t lock;
|
||||
int total;
|
||||
};
|
||||
|
||||
+90
-338
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user