From: Eric Dumazet <eric.dumazet@gmail.com>
To: Octavian Purdila <opurdila@ixiacom.com>
Cc: netdev@vger.kernel.org
Subject: Re: [net-next-2.6 PATCH] net: fast consecutive name allocation
Date: Fri, 13 Nov 2009 07:12:35 +0100 [thread overview]
Message-ID: <4AFCF8D3.6090905@gmail.com> (raw)
In-Reply-To: <200911130720.19671.opurdila@ixiacom.com>
Octavian Purdila a écrit :
> On Friday 13 November 2009 07:01:14 you wrote:
>> This patch speeds up the network device name allocation for the case
>> where a significant number of devices of the same type are created
>> consecutively.
>>
>> Tests performed on a PPC750 @ 800Mhz machine with per device sysctl
>> and sysfs entries disabled:
>>
>> Without the patch With the patch
>>
>> real 0m 43.43s real 0m 0.49s
>> user 0m 0.00s user 0m 0.00s
>> sys 0m 43.43s sys 0m 0.48s
>>
>
> Oops, pasting root prompts (e.g. # modprobe ....) directly into the git commit message is not a good idea :) Here it is again, with the full commit message.
>
> [net-next-2.6 PATCH] net: fast consecutive name allocation
>
> This patch speeds up the network device name allocation for the case
> where a significant number of devices of the same type are created
> consecutively.
>
> Tests performed on a PPC750 @ 800Mhz machine with per device sysctl
> and sysfs entries disabled:
>
> $ time insmod /lib/modules/dummy.ko numdummies=8000
>
> Without the patch With the patch
>
> real 0m 43.43s real 0m 0.49s
> user 0m 0.00s user 0m 0.00s
> sys 0m 43.43s sys 0m 0.48s
>
> Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
> ---
Honestly I dont like this bloat.
Changing dummy.c is trivial, and you can allocate 100.000.000 dummies if you want now :)
I not tested yet this patch but here it is :
[PATCH] dummy: Allow more than 32768 dummies
And speedup name allocation : O(N) instead of O(N^2)
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
drivers/net/dummy.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index 37dcfdc..f600c4c 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -107,12 +107,14 @@ static struct rtnl_link_ops dummy_link_ops __read_mostly = {
module_param(numdummies, int, 0);
MODULE_PARM_DESC(numdummies, "Number of dummy pseudo devices");
-static int __init dummy_init_one(void)
+static int __init dummy_init_one(int i)
{
struct net_device *dev_dummy;
int err;
+ char name[IFNAMSIZ];
- dev_dummy = alloc_netdev(0, "dummy%d", dummy_setup);
+ snprintf(name, IFNAMSIZ, "dummy%d", i);
+ dev_dummy = alloc_netdev(0, name, dummy_setup);
if (!dev_dummy)
return -ENOMEM;
@@ -139,7 +141,7 @@ static int __init dummy_init_module(void)
err = __rtnl_link_register(&dummy_link_ops);
for (i = 0; i < numdummies && !err; i++)
- err = dummy_init_one();
+ err = dummy_init_one(i);
if (err < 0)
__rtnl_link_unregister(&dummy_link_ops);
rtnl_unlock();
next prev parent reply other threads:[~2009-11-13 6:12 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-13 5:01 [net-next-2.6 PATCH] net: fast consecutive name allocation Octavian Purdila
2009-11-13 5:20 ` Octavian Purdila
2009-11-13 6:12 ` Eric Dumazet [this message]
2009-11-13 6:26 ` Stephen Hemminger
2009-11-13 7:09 ` Eric Dumazet
2009-11-13 9:51 ` Octavian Purdila
2009-11-13 22:29 ` Stephen Hemminger
2009-11-13 22:40 ` Benjamin LaHaise
2009-11-13 22:49 ` Stephen Hemminger
2009-11-13 23:35 ` Benjamin LaHaise
2009-11-13 23:39 ` Stephen Hemminger
2009-11-13 23:52 ` Benjamin LaHaise
2009-11-14 2:59 ` David Miller
2009-11-14 6:24 ` Benjamin LaHaise
2009-11-14 22:36 ` Mark Smith
2009-11-15 1:22 ` Stephen Hemminger
2009-11-15 1:49 ` Mark Smith
2009-11-15 1:55 ` Denys Fedoryschenko
2009-11-15 7:48 ` Eric Dumazet
2009-11-15 16:50 ` Benjamin LaHaise
2009-11-14 7:08 ` Benny Amorsen
2009-11-14 7:21 ` Eric Dumazet
2009-11-14 16:16 ` Ben Greear
2009-11-13 9:55 ` Octavian Purdila
2009-11-13 16:40 ` Ben Greear
2009-11-14 0:04 ` Stephen Hemminger
2009-11-14 0:14 ` Octavian Purdila
2009-11-14 0:20 ` Stephen Hemminger
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=4AFCF8D3.6090905@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=opurdila@ixiacom.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;
as well as URLs for NNTP newsgroup(s).