lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1307410786-19110-3-git-send-email-lucian.grijincu@gmail.com>
Date:	Tue,  7 Jun 2011 04:39:46 +0300
From:	Lucian Adrian Grijincu <lucian.grijincu@...il.com>
To:	netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>
Cc:	Eric Dumazet <eric.dumazet@...il.com>,
	Lucian Adrian Grijincu <lucian.grijincu@...il.com>
Subject: [PATCH 2/2] net: dummy: allocate devices with alloc_netdev_id

The most like case is that no one else is registering devices with a
name like "dummy%d".

We can bring the complexity down by replacing:
- alloc_netdev_id which is O(N) with
- alloc_netdev_id which, on the average case, is O(1).

$ time modprobe dummy numdummies=5000
- with alloc_netdev   : 9.50s
- with alloc_netdev_id: 3.50s

NOTE: Stats generated on a heavily patched 3.0-rc1 which replaces the
      current O(N^2) sysctl algorithm with a better one.

Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@...il.com>
---
 drivers/net/dummy.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index 39cf9b9..24d4ee5 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -159,12 +159,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 last_device_id = -1;
 static int __init dummy_init_one(void)
 {
 	struct net_device *dev_dummy;
 	int err;
 
-	dev_dummy = alloc_netdev(0, "dummy%d", dummy_setup);
+	dev_dummy = alloc_netdev_id(0, "dummy%d", dummy_setup, &last_device_id);
 	if (!dev_dummy)
 		return -ENOMEM;
 
-- 
1.7.5.2.317.g391b14

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ