Skip to contentSkip to conversation

net: Introduce dev_get_by_name_rcu()

PATCH New Eric Dumazet 1 participant 1 message Oct 30, 2009

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

PATCH 1/1 net: Introduce dev_get_by_name_rcu()

Some workloads hit dev_base_lock rwlock pretty hard. We can use RCU lookups to avoid touching this rwlock (and avoid touching netdevice refcount)

netdevices are already freed after a RCU grace period, so this patch adds no penalty at device dismantle time.

However, it adds a synchronize_rcu() call in dev_change_name()

---
 include/linux/netdevice.h |    1 
 net/core/dev.c            |   49 +++++++++++++++++++++++++++++-------
 2 files changed, 41 insertions(+), 9 deletions(-)
include/linux/netdevice.h +1 -0
index 193b637..86773e1 100644
@@ -1115,6 +1115,7 @@ extern void		__dev_remove_pack(struct packet_type *pt);
 extern struct net_device	*dev_get_by_flags(struct net *net, unsigned short flags,
 						  unsigned short mask);
 extern struct net_device	*dev_get_by_name(struct net *net, const char *name);
+extern struct net_device	*dev_get_by_name_rcu(struct net *net, const char *name);
 extern struct net_device	*__dev_get_by_name(struct net *net, const char *name);
 extern int		dev_alloc_name(struct net_device *dev, const char *name);
 extern int		dev_open(struct net_device *dev);
net/core/dev.c +40 -9

87 lines not on this page · raw message