Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: David Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Steven Whitehouse <swhiteho@redhat.com>,
	Pavel Emelyanov <xemul@parallels.com>
Subject: Re: [PATCH net-next] af_unix: speedup /proc/net/unix
Date: Sat, 09 Jun 2012 10:10:20 +0200	[thread overview]
Message-ID: <1339229420.6001.146.camel@edumazet-glaptop> (raw)
In-Reply-To: <4FD2E22F.9090503@msgid.tls.msk.ru>

From: Eric Dumazet <edumazet@google.com>

On Sat, 2012-06-09 at 09:42 +0400, Michael Tokarev wrote:
> On 08.06.2012 19:03, Eric Dumazet wrote:
> > From: Eric Dumazet <edumazet@google.com>
> > 
> > /proc/net/unix has quadratic behavior, and can hold unix_table_lock for
> > a while if high number of unix sockets are alive. (90 ms for 200k
> > sockets...)
> 
> Two comments, nitpicking...
> 
> []
> >  struct unix_iter_state {
> >  	struct seq_net_private p;
> > -	int i;
> >  };
> 
> Can't seq_net_private be used directly?
> 

Absolutely

> >  
> >  static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos)
> >  {
> > +	return unix_next_socket(seq, v, pos);
> >  }
> 
> Why unix_seq_next() is needed?  Can't unix_next_socket() be used directly instead?

Nope, you missed the "++*pos;"

static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
	++*pos;
	return unix_next_socket(seq, v, pos);
}

Thanks !

[PATCH net-next] af_unix: remove unix_iter_state

As pointed out by Michael Tokarev , struct unix_iter_state is no longer
needed.

Suggested-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
---
 net/unix/af_unix.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index cf83f6b..79981d9 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2255,10 +2255,6 @@ static unsigned int unix_dgram_poll(struct file *file, struct socket *sock,
 #define get_offset(x) ((x) & ((1L << BUCKET_SPACE) - 1))
 #define set_bucket_offset(b, o) ((b) << BUCKET_SPACE | (o))
 
-struct unix_iter_state {
-	struct seq_net_private p;
-};
-
 static struct sock *unix_from_bucket(struct seq_file *seq, loff_t *pos)
 {
 	unsigned long offset = get_offset(*pos);
@@ -2383,7 +2379,7 @@ static const struct seq_operations unix_seq_ops = {
 static int unix_seq_open(struct inode *inode, struct file *file)
 {
 	return seq_open_net(inode, file, &unix_seq_ops,
-			    sizeof(struct unix_iter_state));
+			    sizeof(struct seq_net_private));
 }
 
 static const struct file_operations unix_seq_fops = {

  reply	other threads:[~2012-06-09  8:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-08 15:03 [PATCH net-next] af_unix: speedup /proc/net/unix Eric Dumazet
2012-06-08 21:28 ` David Miller
2012-06-09  5:42 ` Michael Tokarev
2012-06-09  8:10   ` Eric Dumazet [this message]
2012-06-10  2:06     ` David Miller

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=1339229420.6001.146.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=mjt@tls.msk.ru \
    --cc=netdev@vger.kernel.org \
    --cc=swhiteho@redhat.com \
    --cc=xemul@parallels.com \
    /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