* [Patch net-next] ipv4: remove inet_addr_hash_lock in devinet.c
@ 2014-05-05 18:46 Cong Wang
2014-05-05 20:35 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Cong Wang @ 2014-05-05 18:46 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Cong Wang
All the callers hold RTNL lock, so there is no need to use inet_addr_hash_lock
to protect the hash list.
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index bdbf68b..e497700 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -106,7 +106,6 @@ static const struct nla_policy ifa_ipv4_policy[IFA_MAX+1] = {
#define IN4_ADDR_HSIZE (1U << IN4_ADDR_HSIZE_SHIFT)
static struct hlist_head inet_addr_lst[IN4_ADDR_HSIZE];
-static DEFINE_SPINLOCK(inet_addr_hash_lock);
static u32 inet_addr_hash(struct net *net, __be32 addr)
{
@@ -119,16 +118,12 @@ static void inet_hash_insert(struct net *net, struct in_ifaddr *ifa)
{
u32 hash = inet_addr_hash(net, ifa->ifa_local);
- spin_lock(&inet_addr_hash_lock);
hlist_add_head_rcu(&ifa->hash, &inet_addr_lst[hash]);
- spin_unlock(&inet_addr_hash_lock);
}
static void inet_hash_remove(struct in_ifaddr *ifa)
{
- spin_lock(&inet_addr_hash_lock);
hlist_del_init_rcu(&ifa->hash);
- spin_unlock(&inet_addr_hash_lock);
}
/**
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Patch net-next] ipv4: remove inet_addr_hash_lock in devinet.c
2014-05-05 18:46 [Patch net-next] ipv4: remove inet_addr_hash_lock in devinet.c Cong Wang
@ 2014-05-05 20:35 ` David Miller
2014-05-06 4:33 ` Cong Wang
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2014-05-05 20:35 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 5 May 2014 11:46:50 -0700
> All the callers hold RTNL lock, so there is no need to use inet_addr_hash_lock
> to protect the hash list.
>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
If you are going to do this, please add ASSERT_RTNL() to these two locations
at the same time.
Thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch net-next] ipv4: remove inet_addr_hash_lock in devinet.c
2014-05-05 20:35 ` David Miller
@ 2014-05-06 4:33 ` Cong Wang
0 siblings, 0 replies; 3+ messages in thread
From: Cong Wang @ 2014-05-06 4:33 UTC (permalink / raw)
To: David Miller; +Cc: Linux Kernel Network Developers
On Mon, May 5, 2014 at 1:35 PM, David Miller <davem@davemloft.net> wrote:
> From: Cong Wang <xiyou.wangcong@gmail.com>
> Date: Mon, 5 May 2014 11:46:50 -0700
>
>> All the callers hold RTNL lock, so there is no need to use inet_addr_hash_lock
>> to protect the hash list.
>>
>> Cc: David S. Miller <davem@davemloft.net>
>> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
>
> If you are going to do this, please add ASSERT_RTNL() to these two locations
> at the same time.
>
OK, makes sense. I will send v2.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-06 4:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-05 18:46 [Patch net-next] ipv4: remove inet_addr_hash_lock in devinet.c Cong Wang
2014-05-05 20:35 ` David Miller
2014-05-06 4:33 ` Cong Wang
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).