mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Mihai Maruseac <mihai.maruseac@gmail.com>
Cc: davem@davemloft.net, eric.dumazet@gmail.com,
	mirq-linux@rere.qmqm.pl, therbert@google.com, jpirko@redhat.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	dbaluta@ixiacom.com, Mihai Maruseac <mmaruseac@ixiacom.com>
Subject: Re: [PATCH] dev: use name hash for dev_seq_ops
Date: Fri, 21 Oct 2011 10:07:59 -0700	[thread overview]
Message-ID: <20111021100759.0a6bba45@s6510.linuxnetplumber.net> (raw)
In-Reply-To: <1319179510-10715-1-git-send-email-mmaruseac@ixiacom.com>

On Fri, 21 Oct 2011 09:45:10 +0300
Mihai Maruseac <mihai.maruseac@gmail.com> wrote:

> Instead of using the dev->next chain and trying to resync at each call to
> dev_seq_start, use the name hash, keeping the bucket and the offset in
> seq->private field.
> 
> Tests revealed the following results for ifconfig > /dev/null
> 	* 1000 interfaces:
> 		* 0.114s without patch
> 		* 0.089s with patch
> 	* 3000 interfaces:
> 		* 0.489s without patch
> 		* 0.110s with patch
> 	* 5000 interfaces:
> 		* 1.363s without patch
> 		* 0.250s with patch
> 	* 128000 interfaces (other setup):
> 		* ~100s without patch
> 		* ~30s with patch
> 
> Signed-off-by: Mihai Maruseac <mmaruseac@ixiacom.com>
> ---
>  net/core/dev.c |   84 ++++++++++++++++++++++++++++++++++++++++++++++----------
>  1 files changed, 69 insertions(+), 15 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 70ecb86..6edbcc5 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4041,6 +4041,60 @@ static int dev_ifconf(struct net *net, char __user *arg)
>  }
>  
>  #ifdef CONFIG_PROC_FS
> +
> +#define BUCKET_SPACE (32 - NETDEV_HASHBITS)
> +
> +struct dev_iter_state {
> +	struct seq_net_private p;
> +	unsigned int pos; /* bucket << BUCKET_SPACE + offset */
> +};
> +
> +#define get_bucket(x) ((x) >> BUCKET_SPACE)
> +#define get_offset(x) ((x) & ((1 << BUCKET_SPACE) - 1))
> +#define set_bucket_offset(b, o) ((b) << BUCKET_SPACE | (o))
> +
> +static inline struct net_device *dev_from_same_bucket(struct seq_file *seq)
>

Why are all these function marked inline? They are big, hardly hot path
and better to not continue the bad practice of inlining too much code.

  parent reply	other threads:[~2011-10-21 17:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20  8:01 Mihai Maruseac
2011-10-20 20:17 ` David Miller
2011-10-21  6:45 ` Mihai Maruseac
2011-10-21  6:52   ` Eric Dumazet
2011-10-21  6:55   ` David Miller
2011-10-21 17:07   ` Stephen Hemminger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-10-07 15:20 Mihai Maruseac
2011-10-07 16:24 ` Stephen Hemminger
2011-10-08  7:22   ` Mihai Maruseac
2011-10-10  8:43   ` Mihai Maruseac
2011-10-11  5:55     ` Stephen Hemminger
2011-10-12 10:08       ` Mihai Maruseac

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=20111021100759.0a6bba45@s6510.linuxnetplumber.net \
    --to=shemminger@vyatta.com \
    --cc=davem@davemloft.net \
    --cc=dbaluta@ixiacom.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jpirko@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mihai.maruseac@gmail.com \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=mmaruseac@ixiacom.com \
    --cc=netdev@vger.kernel.org \
    --cc=therbert@google.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

Powered by JetHome