lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 28 Aug 2008 01:35:19 +0200
From:	Andi Kleen <andi@...stfloor.org>
To:	David Miller <davem@...emloft.net>
Cc:	dada1@...mosbay.com, andi@...stfloor.org, davej@...hat.com,
	netdev@...r.kernel.org, j.w.r.degoede@....nl
Subject: Re: cat /proc/net/tcp takes 0.5 seconds on x86_64

On Wed, Aug 27, 2008 at 04:15:04PM -0700, David Miller wrote:
> From: Eric Dumazet <dada1@...mosbay.com>
> Date: Thu, 28 Aug 2008 01:09:19 +0200
> 
> > Not really, I suspect commit (a7ab4b501f9b8a9dc4d5cee542db67b6ccd1088b [TCPv4]: Improve BH latency in /proc/net/tcp) is responsible for longer delays.
> > Note that its rather old :
>  ...
> > We used to disable bh once, while reading the table. This sucked.
> > 
> > In case machine is handling trafic, we now are preemptable by softirqs
> > while reading /proc/net/tcp. Thats a good thing.
> 
> Yes, that would account for it, good spotting.
> 
> > By the way, I find Andi patch usefull. Same thing could be done for /proc/net/rt_cache.
> 
> Fair enough.  If you can cook up a quick rt_cache patch I'll toss it and
> Andi's patch into net-next so it can cook for a while.

Thanks. Here's a little followup patch that implements the same
optimization for inet_diag/ss.
 
-Andi

---

Add empty bucket optimization to inet_diag too

Skip quickly over empty buckets in inet_diag.

Signed-off-by: Andi Kleen <ak@...ux.intel.com>

Index: linux-2.6.27-rc4-misc/net/ipv4/inet_diag.c
===================================================================
--- linux-2.6.27-rc4-misc.orig/net/ipv4/inet_diag.c
+++ linux-2.6.27-rc4-misc/net/ipv4/inet_diag.c
@@ -782,11 +782,15 @@ skip_listen_ht:
 		struct sock *sk;
 		struct hlist_node *node;
 
+		num = 0;
+
+		if (hlist_empty(&head->chain) && hlist_empty(&head->twchain))
+			continue;
+
 		if (i > s_i)
 			s_num = 0;
 
 		read_lock_bh(lock);
-		num = 0;
 		sk_for_each(sk, node, &head->chain) {
 			struct inet_sock *inet = inet_sk(sk);
 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ