Skip to contentSkip to conversation

net: persistent device name bitmaps for faster name allocation

RFC PATCH In review Octavian Purdila 2 participants 2 messages Nov 21, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 net: persistent device name bitmaps for faster name allocation

This patch solves the current scalability issues of dev_name_alloc() by making the device name bitmap persistent. It is based on an idea suggested by Stephen Hemminger.

$ time insmod /lib/modules/dummy.ko numdummies=8000

Without the patch With the patch

real    0m 43.43s           real    0m 0.52s
user    0m 0.00s            user    0m 0.00s
sys     0m 43.43s           sys     0m 0.52s

For each format string (e.g. eth%d) we maintain a device name bitmap. The bitmap starts by allocating one page and can grow up to MAX_DEV_NAME_ORDER.

There is also a limit to the number of bitmaps (MAX_DEV_NAME_BITMAPS). If this limit is reached while trying to allocate a new bitmap we free the last used one.

The device name bitmaps are stored in a rbtree on a per namespace basis.

Open issue: Stephen suggested to register "a VM notifier hook" that could be used to dump the trees in case of memory pressure.

However, I was only able to find the OOM notifier, and I don't know if that would be as useful as a real memory pressure event. Any hints?

---
 include/net/net_namespace.h |    1 +
 net/core/dev.c              |  293 +++++++++++++++++++++++++++++++++++++++----
 2 files changed, 269 insertions(+), 25 deletions(-)
include/net/net_namespace.h +1 -0
index 0addd45..2da2a09 100644
@@ -56,6 +56,7 @@ struct net {
 	struct list_head 	dev_base_head;
 	struct hlist_head 	*dev_name_head;
 	struct hlist_head	*dev_index_head;
+	struct rb_root		dev_name_bitmaps;
 
 	/* core fib_rules */
 	struct list_head	rules_ops;
net/core/dev.c +268 -25

352 lines not on this page · raw message

Signature · 1 line
1.5.6.5
#1 lore raw
Quoted 3 lines · On Sat, 21 Nov 2009 02:37:25 +0200 Octavian Purdila <[email protected]>…

This patch solves the current scalability issues of dev_name_alloc() by making the device name bitmap persistent. It is based on an idea suggested by Stephen Hemminger.

Still not sure that this much code is worth it. Even with 10000 ISP PPPoE links, I can't see that bringing up a new PPP device would be the real bottleneck except in the case of some benchmark that starts them all at once. Even TPC-C benchmarks have a "warm up period".