Skip to contentSkip to conversation

inetpeer: remove unused list

PATCH Applied Eric Dumazet 2 participants 5 messages Jun 8, 2011 – Jun 9, 2011 11 messages not in the archive

Subsystems (4)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 1307501024.3102.1.camel@edumazet-laptop

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 1307502034.3102.2.camel@edumazet-laptop

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 1307504312.3102.9.camel@edumazet-laptop

A message that is not in the archive (sent off-list or not yet received): 1307507299.3102.15.camel@edumazet-laptop

A message that is not in the archive (sent off-list or not yet received): 1307509077.3102.20.camel@edumazet-laptop

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 1307513916.3102.23.camel@edumazet-laptop

A message that is not in the archive (sent off-list or not yet received): 1307514470.3102.25.camel@edumazet-laptop

#11 lore raw

PATCH 1/1 inetpeer: remove unused list

Andi Kleen and Tim Chen reported huge contention on inetpeer unused_peers.lock, on memcached workload on a 40 core machine, with disabled route cache.

It appears we constantly flip peers refcnt between 0 and 1 values, and we must insert/remove peers from unused_peers.list, holding a contended spinlock.

Remove this list completely and perform a garbage collection on-the-fly, at lookup time, using the expired nodes we met during the tree traversal.

This removes a lot of code, makes locking more standard, and obsoletes two sysctls (inet_peer_gc_mintime and inet_peer_gc_maxtime). This also removes two pointers in inet_peer structure.

There is still a false sharing effect because refcnt is in first cache line of object [were the links and keys used by lookups are located], we might move it at the end of inet_peer structure to let this first cache line mostly read by cpus.

---
 Documentation/networking/ip-sysctl.txt |   10 
 include/net/inetpeer.h                 |    2 
 include/net/ip.h                       |    2 
 net/ipv4/inetpeer.c                    |  280 +++++------------------
 net/ipv4/sysctl_net_ipv4.c             |   14 -
 5 files changed, 74 insertions(+), 234 deletions(-)
Documentation/networking/ip-sysctl.txt +0 -10
index d3d653a..3dcb26c 100644
@@ -106,16 +106,6 @@ inet_peer_maxttl - INTEGER
 	when the number of entries in the pool is very small).
 	Measured in seconds.
 
-inet_peer_gc_mintime - INTEGER
-	Minimum interval between garbage collection passes.  This interval is
-	in effect under high memory pressure on the pool.
-	Measured in seconds.
-
-inet_peer_gc_maxtime - INTEGER
-	Minimum interval between garbage collection passes.  This interval is
-	in effect under low (or absent) memory pressure on the pool.
-	Measured in seconds.
-
 TCP variables:
 
 somaxconn - INTEGER
include/net/inetpeer.h +1 -1
index 8a159cc..1f0966f 100644
@@ -32,7 +32,6 @@ struct inet_peer {
 	struct inet_peer __rcu	*avl_left, *avl_right;
 	struct inetpeer_addr	daddr;
 	__u32			avl_height;
-	struct list_head	unused;
 	__u32			dtime;		/* the time of last use of not
 						 * referenced entries */
 	atomic_t		refcnt;
@@ -56,6 +55,7 @@ struct inet_peer {
 			struct inetpeer_addr_base	redirect_learned;
 		};
 		struct rcu_head         rcu;
+		struct inet_peer	*gc_next;
 	};
 };
 
include/net/ip.h +0 -2
index 66dd491..e9ea7c7 100644
@@ -228,8 +228,6 @@ extern struct ctl_path net_ipv4_ctl_path[];
 extern int inet_peer_threshold;
 extern int inet_peer_minttl;
 extern int inet_peer_maxttl;
-extern int inet_peer_gc_mintime;
-extern int inet_peer_gc_maxtime;
 
 /* From ip_output.c */
 extern int sysctl_ip_dynaddr;
net/ipv4/inetpeer.c +73 -207

385 lines not on this page · raw message

net/ipv4/sysctl_net_ipv4.c +0 -14
index 57d0752..69fd720 100644
@@ -398,20 +398,6 @@ static struct ctl_table ipv4_table[] = {
 		.proc_handler	= proc_dointvec_jiffies,
 	},
 	{
-		.procname	= "inet_peer_gc_mintime",
-		.data		= &inet_peer_gc_mintime,
-		.maxlen		= sizeof(int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec_jiffies,
-	},
-	{
-		.procname	= "inet_peer_gc_maxtime",
-		.data		= &inet_peer_gc_maxtime,
-		.maxlen		= sizeof(int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec_jiffies,
-	},
-	{
 		.procname	= "tcp_orphan_retries",
 		.data		= &sysctl_tcp_orphan_retries,
 		.maxlen		= sizeof(int),
maintainer Applied
#12 lore raw

From: Eric Dumazet <[email protected]>
Date: Thu, 09 Jun 2011 01:35:34 +0200

Quoted 16 lines

Andi Kleen and Tim Chen reported huge contention on inetpeer unused_peers.lock, on memcached workload on a 40 core machine, with disabled route cache.

It appears we constantly flip peers refcnt between 0 and 1 values, and we must insert/remove peers from unused_peers.list, holding a contended spinlock.

Remove this list completely and perform a garbage collection on-the-fly, at lookup time, using the expired nodes we met during the tree traversal.

This removes a lot of code, makes locking more standard, and obsoletes two sysctls (inet_peer_gc_mintime and inet_peer_gc_maxtime). This also removes two pointers in inet_peer structure.

Quoted 6 lines

There is still a false sharing effect because refcnt is in first cache line of object [were the links and keys used by lookups are located], we might move it at the end of inet_peer structure to let this first cache line mostly read by cpus.

Didn't expect you to implement this so fast :-)

Applied, thanks!

#13 lore raw
Quoted 24 lines · David Miller

From: Eric Dumazet <[email protected]>
Date: Thu, 09 Jun 2011 01:35:34 +0200

Quoted 21 lines

Andi Kleen and Tim Chen reported huge contention on inetpeer unused_peers.lock, on memcached workload on a 40 core machine, with disabled route cache.

It appears we constantly flip peers refcnt between 0 and 1 values, and we must insert/remove peers from unused_peers.list, holding a contended spinlock.

Remove this list completely and perform a garbage collection on-the-fly, at lookup time, using the expired nodes we met during the tree traversal.

This removes a lot of code, makes locking more standard, and obsoletes two sysctls (inet_peer_gc_mintime and inet_peer_gc_maxtime). This also removes two pointers in inet_peer structure.

There is still a false sharing effect because refcnt is in first cache line of object [were the links and keys used by lookups are located], we might move it at the end of inet_peer structure to let this first cache line mostly read by cpus.

Quoted 5 lines
Quoted 1 line

Didn't expect you to implement this so fast :-)

Applied, thanks!

Thanks David

I would be glad to hear about numbers from Andi and Tim, I am very jealous of their 80 Threads machine ;)

maintainer
#14 lore raw

From: Eric Dumazet <[email protected]>
Date: Thu, 09 Jun 2011 05:47:34 +0200

Quoted 2 lines

I would be glad to hear about numbers from Andi and Tim, I am very jealous of their 80 Threads machine ;)

Don't be, you can play on my 128 thread machine any time you want :-)

#15 lore raw
Quoted 7 lines · David Miller

From: Eric Dumazet <[email protected]>
Date: Thu, 09 Jun 2011 05:47:34 +0200

Quoted 2 lines

I would be glad to hear about numbers from Andi and Tim, I am very jealous of their 80 Threads machine ;)

Don't be, you can play on my 128 thread machine any time you want :-)

I believe they also have 40Gb NICs to play with huge memcached load, is your machine still a candidate, with others in the lab to be used as clients ? :)