All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/7] ipv6: addrconf: hash improvements and cleanups
@ 2017-10-23 23:17 Eric Dumazet
  2017-10-23 23:17 ` [PATCH net-next 1/7] ipv6: addrconf: move ipv6_chk_same_addr() to avoid forward declaration Eric Dumazet
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Eric Dumazet @ 2017-10-23 23:17 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

Remove unecessary BH blocking, and bring IPv6 addrconf to modern world,
with per netns hash perturbation and decent hash size.

Eric Dumazet (7):
  ipv6: addrconf: move ipv6_chk_same_addr() to avoid forward declaration
  ipv6: addrconf: factorize inet6_addr_hash() call
  ipv6: addrconf: add per netns perturbation in inet6_addr_hash()
  ipv6: addrconf: do not block BH in ipv6_chk_addr_and_flags()
  ipv6: addrconf: do not block BH in ipv6_get_ifaddr()
  ipv6: addrconf: do not block BH in /proc/net/if_inet6 handling
  ipv6: addrconf: do not block BH in ipv6_chk_home_addr()

 include/net/addrconf.h |  2 +-
 net/ipv6/addrconf.c    | 94 ++++++++++++++++++++++++--------------------------
 2 files changed, 46 insertions(+), 50 deletions(-)

-- 
2.15.0.rc0.271.g36b669edcc-goog

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net-next 1/7] ipv6: addrconf: move ipv6_chk_same_addr() to avoid forward declaration
  2017-10-23 23:17 [PATCH net-next 0/7] ipv6: addrconf: hash improvements and cleanups Eric Dumazet
@ 2017-10-23 23:17 ` Eric Dumazet
  2017-10-23 23:17 ` [PATCH net-next 2/7] ipv6: addrconf: factorize inet6_addr_hash() call Eric Dumazet
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2017-10-23 23:17 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

ipv6_chk_same_addr() is only used by ipv6_add_addr_hash(),
so moving it avoids a forward declaration.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv6/addrconf.c | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 93f9c0a619119f0520363206fbdc1aae49fbb1e6..9228030e34970c1d6380e95e8c193496448ea8ac 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -192,8 +192,6 @@ static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa);
 
 static void inet6_prefix_notify(int event, struct inet6_dev *idev,
 				struct prefix_info *pinfo);
-static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
-			       struct net_device *dev);
 
 static struct ipv6_devconf ipv6_devconf __read_mostly = {
 	.forwarding		= 0,
@@ -957,6 +955,23 @@ static u32 inet6_addr_hash(const struct in6_addr *addr)
 	return hash_32(ipv6_addr_hash(addr), IN6_ADDR_HSIZE_SHIFT);
 }
 
+static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
+			       struct net_device *dev)
+{
+	unsigned int hash = inet6_addr_hash(addr);
+	struct inet6_ifaddr *ifp;
+
+	hlist_for_each_entry(ifp, &inet6_addr_lst[hash], addr_lst) {
+		if (!net_eq(dev_net(ifp->idev->dev), net))
+			continue;
+		if (ipv6_addr_equal(&ifp->addr, addr)) {
+			if (!dev || ifp->idev->dev == dev)
+				return true;
+		}
+	}
+	return false;
+}
+
 static int ipv6_add_addr_hash(struct net_device *dev, struct inet6_ifaddr *ifa)
 {
 	unsigned int hash;
@@ -1856,22 +1871,6 @@ int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr,
 }
 EXPORT_SYMBOL(ipv6_chk_addr_and_flags);
 
-static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
-			       struct net_device *dev)
-{
-	unsigned int hash = inet6_addr_hash(addr);
-	struct inet6_ifaddr *ifp;
-
-	hlist_for_each_entry(ifp, &inet6_addr_lst[hash], addr_lst) {
-		if (!net_eq(dev_net(ifp->idev->dev), net))
-			continue;
-		if (ipv6_addr_equal(&ifp->addr, addr)) {
-			if (!dev || ifp->idev->dev == dev)
-				return true;
-		}
-	}
-	return false;
-}
 
 /* Compares an address/prefix_len with addresses on device @dev.
  * If one is found it returns true.
-- 
2.15.0.rc0.271.g36b669edcc-goog

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net-next 2/7] ipv6: addrconf: factorize inet6_addr_hash() call
  2017-10-23 23:17 [PATCH net-next 0/7] ipv6: addrconf: hash improvements and cleanups Eric Dumazet
  2017-10-23 23:17 ` [PATCH net-next 1/7] ipv6: addrconf: move ipv6_chk_same_addr() to avoid forward declaration Eric Dumazet
@ 2017-10-23 23:17 ` Eric Dumazet
  2017-10-23 23:17 ` [PATCH net-next 3/7] ipv6: addrconf: add per netns perturbation in inet6_addr_hash() Eric Dumazet
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2017-10-23 23:17 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

ipv6_add_addr_hash() can compute the hash value outside of
locked section and pass it to ipv6_chk_same_addr().

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv6/addrconf.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 9228030e34970c1d6380e95e8c193496448ea8ac..c1a5028f394c75d347fe703573548fd617b5c142 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -956,9 +956,8 @@ static u32 inet6_addr_hash(const struct in6_addr *addr)
 }
 
 static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
-			       struct net_device *dev)
+			       struct net_device *dev, unsigned int hash)
 {
-	unsigned int hash = inet6_addr_hash(addr);
 	struct inet6_ifaddr *ifp;
 
 	hlist_for_each_entry(ifp, &inet6_addr_lst[hash], addr_lst) {
@@ -974,23 +973,19 @@ static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
 
 static int ipv6_add_addr_hash(struct net_device *dev, struct inet6_ifaddr *ifa)
 {
-	unsigned int hash;
+	unsigned int hash = inet6_addr_hash(&ifa->addr);
 	int err = 0;
 
 	spin_lock(&addrconf_hash_lock);
 
 	/* Ignore adding duplicate addresses on an interface */
-	if (ipv6_chk_same_addr(dev_net(dev), &ifa->addr, dev)) {
+	if (ipv6_chk_same_addr(dev_net(dev), &ifa->addr, dev, hash)) {
 		ADBG("ipv6_add_addr: already assigned\n");
 		err = -EEXIST;
-		goto out;
+	} else {
+		hlist_add_head_rcu(&ifa->addr_lst, &inet6_addr_lst[hash]);
 	}
 
-	/* Add to big hash table */
-	hash = inet6_addr_hash(&ifa->addr);
-	hlist_add_head_rcu(&ifa->addr_lst, &inet6_addr_lst[hash]);
-
-out:
 	spin_unlock(&addrconf_hash_lock);
 
 	return err;
-- 
2.15.0.rc0.271.g36b669edcc-goog

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net-next 3/7] ipv6: addrconf: add per netns perturbation in inet6_addr_hash()
  2017-10-23 23:17 [PATCH net-next 0/7] ipv6: addrconf: hash improvements and cleanups Eric Dumazet
  2017-10-23 23:17 ` [PATCH net-next 1/7] ipv6: addrconf: move ipv6_chk_same_addr() to avoid forward declaration Eric Dumazet
  2017-10-23 23:17 ` [PATCH net-next 2/7] ipv6: addrconf: factorize inet6_addr_hash() call Eric Dumazet
@ 2017-10-23 23:17 ` Eric Dumazet
  2017-10-23 23:17 ` [PATCH net-next 4/7] ipv6: addrconf: do not block BH in ipv6_chk_addr_and_flags() Eric Dumazet
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2017-10-23 23:17 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

Bring IPv6 in par with IPv4 :

- Use net_hash_mix() to spread addresses a bit more.
- Use 256 slots hash table instead of 16

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/net/addrconf.h |  2 +-
 net/ipv6/addrconf.c    | 16 +++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index b8b16437c6d5bcb9c8b5c42b4f9c0161b477d605..15b5ffd7253d6088f2444ada5de99e4977e143ff 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -58,7 +58,7 @@ struct in6_validator_info {
 	struct netlink_ext_ack	*extack;
 };
 
-#define IN6_ADDR_HSIZE_SHIFT	4
+#define IN6_ADDR_HSIZE_SHIFT	8
 #define IN6_ADDR_HSIZE		(1 << IN6_ADDR_HSIZE_SHIFT)
 
 int addrconf_init(void);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index c1a5028f394c75d347fe703573548fd617b5c142..d70d98122053652b4f4420786de8788c6c9385ff 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -950,9 +950,11 @@ ipv6_link_dev_addr(struct inet6_dev *idev, struct inet6_ifaddr *ifp)
 	list_add_tail_rcu(&ifp->if_list, p);
 }
 
-static u32 inet6_addr_hash(const struct in6_addr *addr)
+static u32 inet6_addr_hash(const struct net *net, const struct in6_addr *addr)
 {
-	return hash_32(ipv6_addr_hash(addr), IN6_ADDR_HSIZE_SHIFT);
+	u32 val = ipv6_addr_hash(addr) ^ net_hash_mix(net);
+
+	return hash_32(val, IN6_ADDR_HSIZE_SHIFT);
 }
 
 static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
@@ -973,7 +975,7 @@ static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
 
 static int ipv6_add_addr_hash(struct net_device *dev, struct inet6_ifaddr *ifa)
 {
-	unsigned int hash = inet6_addr_hash(&ifa->addr);
+	unsigned int hash = inet6_addr_hash(dev_net(dev), &ifa->addr);
 	int err = 0;
 
 	spin_lock(&addrconf_hash_lock);
@@ -1838,8 +1840,8 @@ int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr,
 			    const struct net_device *dev, int strict,
 			    u32 banned_flags)
 {
+	unsigned int hash = inet6_addr_hash(net, addr);
 	struct inet6_ifaddr *ifp;
-	unsigned int hash = inet6_addr_hash(addr);
 	u32 ifp_flags;
 
 	rcu_read_lock_bh();
@@ -1917,8 +1919,8 @@ EXPORT_SYMBOL(ipv6_chk_prefix);
 struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, const struct in6_addr *addr,
 				     struct net_device *dev, int strict)
 {
+	unsigned int hash = inet6_addr_hash(net, addr);
 	struct inet6_ifaddr *ifp, *result = NULL;
-	unsigned int hash = inet6_addr_hash(addr);
 
 	rcu_read_lock_bh();
 	hlist_for_each_entry_rcu_bh(ifp, &inet6_addr_lst[hash], addr_lst) {
@@ -4242,9 +4244,9 @@ void if6_proc_exit(void)
 /* Check if address is a home address configured on any interface. */
 int ipv6_chk_home_addr(struct net *net, const struct in6_addr *addr)
 {
-	int ret = 0;
+	unsigned int hash = inet6_addr_hash(net, addr);
 	struct inet6_ifaddr *ifp = NULL;
-	unsigned int hash = inet6_addr_hash(addr);
+	int ret = 0;
 
 	rcu_read_lock_bh();
 	hlist_for_each_entry_rcu_bh(ifp, &inet6_addr_lst[hash], addr_lst) {
-- 
2.15.0.rc0.271.g36b669edcc-goog

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net-next 4/7] ipv6: addrconf: do not block BH in ipv6_chk_addr_and_flags()
  2017-10-23 23:17 [PATCH net-next 0/7] ipv6: addrconf: hash improvements and cleanups Eric Dumazet
                   ` (2 preceding siblings ...)
  2017-10-23 23:17 ` [PATCH net-next 3/7] ipv6: addrconf: add per netns perturbation in inet6_addr_hash() Eric Dumazet
@ 2017-10-23 23:17 ` Eric Dumazet
  2017-10-23 23:17 ` [PATCH net-next 5/7] ipv6: addrconf: do not block BH in ipv6_get_ifaddr() Eric Dumazet
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2017-10-23 23:17 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

rcu_read_lock() is enough here, as inet6_ifa_finish_destroy()
uses kfree_rcu()

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv6/addrconf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d70d98122053652b4f4420786de8788c6c9385ff..a6cf37b7e34c461e204153078be92c3e297b3ec2 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1844,7 +1844,7 @@ int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr,
 	struct inet6_ifaddr *ifp;
 	u32 ifp_flags;
 
-	rcu_read_lock_bh();
+	rcu_read_lock();
 	hlist_for_each_entry_rcu(ifp, &inet6_addr_lst[hash], addr_lst) {
 		if (!net_eq(dev_net(ifp->idev->dev), net))
 			continue;
@@ -1858,12 +1858,12 @@ int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr,
 		    !(ifp_flags&banned_flags) &&
 		    (!dev || ifp->idev->dev == dev ||
 		     !(ifp->scope&(IFA_LINK|IFA_HOST) || strict))) {
-			rcu_read_unlock_bh();
+			rcu_read_unlock();
 			return 1;
 		}
 	}
 
-	rcu_read_unlock_bh();
+	rcu_read_unlock();
 	return 0;
 }
 EXPORT_SYMBOL(ipv6_chk_addr_and_flags);
-- 
2.15.0.rc0.271.g36b669edcc-goog

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net-next 5/7] ipv6: addrconf: do not block BH in ipv6_get_ifaddr()
  2017-10-23 23:17 [PATCH net-next 0/7] ipv6: addrconf: hash improvements and cleanups Eric Dumazet
                   ` (3 preceding siblings ...)
  2017-10-23 23:17 ` [PATCH net-next 4/7] ipv6: addrconf: do not block BH in ipv6_chk_addr_and_flags() Eric Dumazet
@ 2017-10-23 23:17 ` Eric Dumazet
  2017-10-23 23:17 ` [PATCH net-next 6/7] ipv6: addrconf: do not block BH in /proc/net/if_inet6 handling Eric Dumazet
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2017-10-23 23:17 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

rcu_read_lock() is enough here, no need to block BH.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv6/addrconf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index a6cf37b7e34c461e204153078be92c3e297b3ec2..6c1e7ffb62ff2333d63b3c7639d99649d43b32fc 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1922,8 +1922,8 @@ struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, const struct in6_addr *add
 	unsigned int hash = inet6_addr_hash(net, addr);
 	struct inet6_ifaddr *ifp, *result = NULL;
 
-	rcu_read_lock_bh();
-	hlist_for_each_entry_rcu_bh(ifp, &inet6_addr_lst[hash], addr_lst) {
+	rcu_read_lock();
+	hlist_for_each_entry_rcu(ifp, &inet6_addr_lst[hash], addr_lst) {
 		if (!net_eq(dev_net(ifp->idev->dev), net))
 			continue;
 		if (ipv6_addr_equal(&ifp->addr, addr)) {
@@ -1935,7 +1935,7 @@ struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, const struct in6_addr *add
 			}
 		}
 	}
-	rcu_read_unlock_bh();
+	rcu_read_unlock();
 
 	return result;
 }
-- 
2.15.0.rc0.271.g36b669edcc-goog

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net-next 6/7] ipv6: addrconf: do not block BH in /proc/net/if_inet6 handling
  2017-10-23 23:17 [PATCH net-next 0/7] ipv6: addrconf: hash improvements and cleanups Eric Dumazet
                   ` (4 preceding siblings ...)
  2017-10-23 23:17 ` [PATCH net-next 5/7] ipv6: addrconf: do not block BH in ipv6_get_ifaddr() Eric Dumazet
@ 2017-10-23 23:17 ` Eric Dumazet
  2017-10-23 23:17 ` [PATCH net-next 7/7] ipv6: addrconf: do not block BH in ipv6_chk_home_addr() Eric Dumazet
  2017-10-24  8:54 ` [PATCH net-next 0/7] ipv6: addrconf: hash improvements and cleanups David Miller
  7 siblings, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2017-10-23 23:17 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

Table is really RCU protected, no need to block BH

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv6/addrconf.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 6c1e7ffb62ff2333d63b3c7639d99649d43b32fc..9232e9537082ea44f5e0af4e4b0d052d780395fd 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4097,9 +4097,9 @@ struct if6_iter_state {
 
 static struct inet6_ifaddr *if6_get_first(struct seq_file *seq, loff_t pos)
 {
-	struct inet6_ifaddr *ifa = NULL;
 	struct if6_iter_state *state = seq->private;
 	struct net *net = seq_file_net(seq);
+	struct inet6_ifaddr *ifa = NULL;
 	int p = 0;
 
 	/* initial bucket if pos is 0 */
@@ -4109,7 +4109,7 @@ static struct inet6_ifaddr *if6_get_first(struct seq_file *seq, loff_t pos)
 	}
 
 	for (; state->bucket < IN6_ADDR_HSIZE; ++state->bucket) {
-		hlist_for_each_entry_rcu_bh(ifa, &inet6_addr_lst[state->bucket],
+		hlist_for_each_entry_rcu(ifa, &inet6_addr_lst[state->bucket],
 					 addr_lst) {
 			if (!net_eq(dev_net(ifa->idev->dev), net))
 				continue;
@@ -4135,7 +4135,7 @@ static struct inet6_ifaddr *if6_get_next(struct seq_file *seq,
 	struct if6_iter_state *state = seq->private;
 	struct net *net = seq_file_net(seq);
 
-	hlist_for_each_entry_continue_rcu_bh(ifa, addr_lst) {
+	hlist_for_each_entry_continue_rcu(ifa, addr_lst) {
 		if (!net_eq(dev_net(ifa->idev->dev), net))
 			continue;
 		state->offset++;
@@ -4144,7 +4144,7 @@ static struct inet6_ifaddr *if6_get_next(struct seq_file *seq,
 
 	while (++state->bucket < IN6_ADDR_HSIZE) {
 		state->offset = 0;
-		hlist_for_each_entry_rcu_bh(ifa,
+		hlist_for_each_entry_rcu(ifa,
 				     &inet6_addr_lst[state->bucket], addr_lst) {
 			if (!net_eq(dev_net(ifa->idev->dev), net))
 				continue;
@@ -4157,9 +4157,9 @@ static struct inet6_ifaddr *if6_get_next(struct seq_file *seq,
 }
 
 static void *if6_seq_start(struct seq_file *seq, loff_t *pos)
-	__acquires(rcu_bh)
+	__acquires(rcu)
 {
-	rcu_read_lock_bh();
+	rcu_read_lock();
 	return if6_get_first(seq, *pos);
 }
 
@@ -4173,9 +4173,9 @@ static void *if6_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 }
 
 static void if6_seq_stop(struct seq_file *seq, void *v)
-	__releases(rcu_bh)
+	__releases(rcu)
 {
-	rcu_read_unlock_bh();
+	rcu_read_unlock();
 }
 
 static int if6_seq_show(struct seq_file *seq, void *v)
-- 
2.15.0.rc0.271.g36b669edcc-goog

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net-next 7/7] ipv6: addrconf: do not block BH in ipv6_chk_home_addr()
  2017-10-23 23:17 [PATCH net-next 0/7] ipv6: addrconf: hash improvements and cleanups Eric Dumazet
                   ` (5 preceding siblings ...)
  2017-10-23 23:17 ` [PATCH net-next 6/7] ipv6: addrconf: do not block BH in /proc/net/if_inet6 handling Eric Dumazet
@ 2017-10-23 23:17 ` Eric Dumazet
  2017-10-24  8:54 ` [PATCH net-next 0/7] ipv6: addrconf: hash improvements and cleanups David Miller
  7 siblings, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2017-10-23 23:17 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

rcu_read_lock() is enough here, no need to block BH.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv6/addrconf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 9232e9537082ea44f5e0af4e4b0d052d780395fd..5a8a10229a07fe3d3f96b237e744332c192a509f 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4248,8 +4248,8 @@ int ipv6_chk_home_addr(struct net *net, const struct in6_addr *addr)
 	struct inet6_ifaddr *ifp = NULL;
 	int ret = 0;
 
-	rcu_read_lock_bh();
-	hlist_for_each_entry_rcu_bh(ifp, &inet6_addr_lst[hash], addr_lst) {
+	rcu_read_lock();
+	hlist_for_each_entry_rcu(ifp, &inet6_addr_lst[hash], addr_lst) {
 		if (!net_eq(dev_net(ifp->idev->dev), net))
 			continue;
 		if (ipv6_addr_equal(&ifp->addr, addr) &&
@@ -4258,7 +4258,7 @@ int ipv6_chk_home_addr(struct net *net, const struct in6_addr *addr)
 			break;
 		}
 	}
-	rcu_read_unlock_bh();
+	rcu_read_unlock();
 	return ret;
 }
 #endif
-- 
2.15.0.rc0.271.g36b669edcc-goog

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 0/7] ipv6: addrconf: hash improvements and cleanups
  2017-10-23 23:17 [PATCH net-next 0/7] ipv6: addrconf: hash improvements and cleanups Eric Dumazet
                   ` (6 preceding siblings ...)
  2017-10-23 23:17 ` [PATCH net-next 7/7] ipv6: addrconf: do not block BH in ipv6_chk_home_addr() Eric Dumazet
@ 2017-10-24  8:54 ` David Miller
  7 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2017-10-24  8:54 UTC (permalink / raw)
  To: edumazet; +Cc: netdev, eric.dumazet

From: Eric Dumazet <edumazet@google.com>
Date: Mon, 23 Oct 2017 16:17:44 -0700

> Remove unecessary BH blocking, and bring IPv6 addrconf to modern world,
> with per netns hash perturbation and decent hash size.

Series applied.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-10-24  8:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-23 23:17 [PATCH net-next 0/7] ipv6: addrconf: hash improvements and cleanups Eric Dumazet
2017-10-23 23:17 ` [PATCH net-next 1/7] ipv6: addrconf: move ipv6_chk_same_addr() to avoid forward declaration Eric Dumazet
2017-10-23 23:17 ` [PATCH net-next 2/7] ipv6: addrconf: factorize inet6_addr_hash() call Eric Dumazet
2017-10-23 23:17 ` [PATCH net-next 3/7] ipv6: addrconf: add per netns perturbation in inet6_addr_hash() Eric Dumazet
2017-10-23 23:17 ` [PATCH net-next 4/7] ipv6: addrconf: do not block BH in ipv6_chk_addr_and_flags() Eric Dumazet
2017-10-23 23:17 ` [PATCH net-next 5/7] ipv6: addrconf: do not block BH in ipv6_get_ifaddr() Eric Dumazet
2017-10-23 23:17 ` [PATCH net-next 6/7] ipv6: addrconf: do not block BH in /proc/net/if_inet6 handling Eric Dumazet
2017-10-23 23:17 ` [PATCH net-next 7/7] ipv6: addrconf: do not block BH in ipv6_chk_home_addr() Eric Dumazet
2017-10-24  8:54 ` [PATCH net-next 0/7] ipv6: addrconf: hash improvements and cleanups David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.