| To: | herbert@xxxxxxxxxxxxxxxxxxx, meissner@xxxxxxx |
|---|---|
| Subject: | Re: [patch] do not readlock all buckets in /proc/net/tcp |
| From: | YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@xxxxxxxxxxxxxx> |
| Date: | Mon, 05 Jul 2004 21:25:22 +0900 (JST) |
| Cc: | netdev@xxxxxxxxxxx, yoshfuji@xxxxxxxxxxxxxx |
| In-reply-to: | <20040705120610.GA5728@xxxxxxxxxxxxxxxxxxx> |
| Organization: | USAGI Project |
| References: | <E1BhRda-0001Rs-00@xxxxxxxxxxxxxxxxxxxxxxxx> <20040705113555.GA28665@xxxxxxx> <20040705120610.GA5728@xxxxxxxxxxxxxxxxxxx> |
| Sender: | netdev-bounce@xxxxxxxxxxx |
In article <20040705120610.GA5728@xxxxxxxxxxxxxxxxxxx> (at Mon, 5 Jul 2004
22:06:10 +1000), Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxx>
===== 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;
+
+ read_lock_bh(&head->lock);
sk_for_each(sk, node, &head->chain) {
struct inet_opt *inet = inet_sk(sk);
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@xxxxxxxxxxxxxx>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [patch] do not readlock all buckets in /proc/net/tcp, Marcus Meissner |
|---|---|
| Next by Date: | Re: [patch] do not readlock all buckets in /proc/net/tcp, YOSHIFUJI Hideaki / 吉藤英明 |
| Previous by Thread: | Re: [patch] do not readlock all buckets in /proc/net/tcp, Herbert Xu |
| Next by Thread: | Re: [patch] do not readlock all buckets in /proc/net/tcp, Marcus Meissner |
| Indexes: | [Date] [Thread] [Top] [All Lists] |