[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1339229420.6001.146.camel@edumazet-glaptop>
Date: Sat, 09 Jun 2012 10:10:20 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Michael Tokarev <mjt@....msk.ru>
Cc: David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Steven Whitehouse <swhiteho@...hat.com>,
Pavel Emelyanov <xemul@...allels.com>
Subject: Re: [PATCH net-next] af_unix: speedup /proc/net/unix
From: Eric Dumazet <edumazet@...gle.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@...gle.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@....msk.ru>
Signed-off-by: Eric Dumazet <edumazet@...gle.com>
Cc: Steven Whitehouse <swhiteho@...hat.com>
Cc: Pavel Emelyanov <xemul@...allels.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 = {
--
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