netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcus Meissner <meissner@suse.de>
To: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
Cc: netdev@oss.sgi.com
Subject: Re: [patch] do not readlock all buckets in /proc/net/tcp
Date: Mon, 5 Jul 2004 14:45:11 +0200	[thread overview]
Message-ID: <20040705124511.GA17193@suse.de> (raw)
In-Reply-To: <20040705.212522.126409437.yoshfuji@linux-ipv6.org>

On Mon, Jul 05, 2004 at 09:25:22PM +0900, YOSHIFUJI Hideaki / 吉藤英明 wrote:
> In article <20040705120610.GA5728@gondor.apana.org.au> (at Mon, 5 Jul 2004 22:06:10 +1000), Herbert Xu <herbert@gondor.apana.org.au> says:
> 
> > On Mon, Jul 05, 2004 at 01:35:55PM +0200, Marcus Meissner wrote:
> > > 
> > > Oh, and NETLINK+TCP_DIAG seems to have the same readlock contention problem,
> > > see tcpdiag_dump().
> > 
> > Then you wouldn't mind adding this optimisation for tcp_diag as well,
> > right? :)
> 
> here it is. :-)
> 
> Signed-off-by: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
> 
> ===== net/ipv4/tcp_diag.c 1.15 vs edited =====
> --- 1.15/net/ipv4/tcp_diag.c	2004-06-08 07:27:58 +09:00
> +++ edited/net/ipv4/tcp_diag.c	2004-07-05 21:18:17 +09:00
> @@ -522,9 +522,13 @@
>  		if (i > s_i)
>  			s_num = 0;
>  
> -		read_lock_bh(&head->lock);
> -
>  		num = 0;
> +
> +		if (hlist_empty(&head->chain) &&
> +		    (!(r->tcpdiag_states&TCPF_TIME_WAIT) || hlist_empty(&head->chain)))
> +			continue;

The second hlist_empty is bad, you should be checking &tcp_ehash[i +
tcp_ehash_size].chain ((head+tcp_ehash_size) I think).


Ciao, Marcus

  reply	other threads:[~2004-07-05 12:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-05 11:09 [patch] do not readlock all buckets in /proc/net/tcp Marcus Meissner
2004-07-05 11:27 ` Herbert Xu
2004-07-05 11:35   ` Marcus Meissner
2004-07-05 12:06     ` Herbert Xu
2004-07-05 12:25       ` YOSHIFUJI Hideaki / 吉藤英明
2004-07-05 12:45         ` Marcus Meissner [this message]
2004-07-05 13:25           ` YOSHIFUJI Hideaki / 吉藤英明

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040705124511.GA17193@suse.de \
    --to=meissner@suse.de \
    --cc=netdev@oss.sgi.com \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).