Skip to contentSkip to conversation

Making fib_semantics.c scale

PATCH New David S. Miller 1 participant 1 message Sep 14, 2004

Subsystems (2)
lore
Share & tools
lore

David S. Miller

author maintainer
#0 lore raw

PATCH 1/1 Making fib_semantics.c scale

Ben, I've been hacking on fixing the routing scaling issues you found with your L2TP work.

You mention dev_get_by_index() et al, those are already using nicer lookup schemes in the 2.6.x kernel and I'd happily accept a 2.4.x backport.

The patch below is what I'm working with, against current 2.6.x It takes care of the fib_create_info() and fib_sync_down() overhead. fn_hash_flush() will probably still show up in your profiles and slow things down a bit, that one is a little harder to solve.

Give this a go and let me know how well it works to improve your test case.

Thanks.

net/ip_fib.h renamed from linus-2.6/include/net/ip_fib.h +12 -13
@@ -23,8 +23,7 @@
 /* WARNING: The ordering of these elements must match ordering
  *          of RTA_* rtnetlink attribute numbers.
  */
-struct kern_rta
-{
+struct kern_rta {
 	void		*rta_dst;
 	void		*rta_src;
 	int		*rta_iif;
@@ -40,9 +39,12 @@
 	struct rta_session *rta_sess;
 };
 
-struct fib_nh
-{
-	struct net_device		*nh_dev;
+struct fib_info;
+
+struct fib_nh {
+	struct net_device	*nh_dev;
+	struct hlist_node	nh_hash;
+	struct fib_info		*nh_parent;
 	unsigned		nh_flags;
 	unsigned char		nh_scope;
 #ifdef CONFIG_IP_ROUTE_MULTIPATH
@@ -60,10 +62,9 @@
  * This structure contains data shared by many of routes.
  */
 
-struct fib_info
-{
-	struct fib_info		*fib_next;
-	struct fib_info		*fib_prev;
+struct fib_info {
+	struct hlist_node	fib_hash;
+	struct hlist_node	fib_lhash;
 	int			fib_treeref;
 	atomic_t		fib_clntref;
 	int			fib_dead;
@@ -89,8 +90,7 @@
 struct fib_rule;
 #endif
 
-struct fib_result
-{
+struct fib_result {
 	unsigned char	prefixlen;
 	unsigned char	nh_sel;
 	unsigned char	type;
@@ -119,8 +119,7 @@
 #define FIB_RES_DEV(res)		(FIB_RES_NH(res).nh_dev)
 #define FIB_RES_OIF(res)		(FIB_RES_NH(res).nh_oif)
 
-struct fib_table
-{
+struct fib_table {
 	unsigned char	tb_id;
 	unsigned	tb_stamp;
 	int		(*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res);
ipv4/fib_semantics.c renamed from linus-2.6/net/ipv4/fib_semantics.c +263 -46

404 lines not on this page · raw message