diff options
author | Thomas Graf <tgraf@suug.ch> | 2014-11-13 07:45:46 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-11-13 15:18:40 -0500 |
commit | 6eba82248ef47fd478f940a418429e3ec95cb3db (patch) | |
tree | 77e82bd157c6b164347f02ba6c33e5abe4860f86 /net/netlink | |
parent | 64bb7e9949c03bff9463c40bfa740f611fb5500d (diff) |
rhashtable: Drop gfp_flags arg in insert/remove functions
Reallocation is only required for shrinking and expanding and both rely
on a mutex for synchronization and callers of rhashtable_init() are in
non atomic context. Therefore, no reason to continue passing allocation
hints through the API.
Instead, use GFP_KERNEL and add __GFP_NOWARN | __GFP_NORETRY to allow
for silent fall back to vzalloc() without the OOM killer jumping in as
pointed out by Eric Dumazet and Eric W. Biederman.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink')
-rw-r--r-- | net/netlink/af_netlink.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 9e0628cfdf67..a491c1a4861f 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1092,7 +1092,7 @@ static int netlink_insert(struct sock *sk, struct net *net, u32 portid) | |||
1092 | 1092 | ||
1093 | nlk_sk(sk)->portid = portid; | 1093 | nlk_sk(sk)->portid = portid; |
1094 | sock_hold(sk); | 1094 | sock_hold(sk); |
1095 | rhashtable_insert(&table->hash, &nlk_sk(sk)->node, GFP_KERNEL); | 1095 | rhashtable_insert(&table->hash, &nlk_sk(sk)->node); |
1096 | err = 0; | 1096 | err = 0; |
1097 | err: | 1097 | err: |
1098 | mutex_unlock(&nl_sk_hash_lock); | 1098 | mutex_unlock(&nl_sk_hash_lock); |
@@ -1105,7 +1105,7 @@ static void netlink_remove(struct sock *sk) | |||
1105 | 1105 | ||
1106 | mutex_lock(&nl_sk_hash_lock); | 1106 | mutex_lock(&nl_sk_hash_lock); |
1107 | table = &nl_table[sk->sk_protocol]; | 1107 | table = &nl_table[sk->sk_protocol]; |
1108 | if (rhashtable_remove(&table->hash, &nlk_sk(sk)->node, GFP_KERNEL)) { | 1108 | if (rhashtable_remove(&table->hash, &nlk_sk(sk)->node)) { |
1109 | WARN_ON(atomic_read(&sk->sk_refcnt) == 1); | 1109 | WARN_ON(atomic_read(&sk->sk_refcnt) == 1); |
1110 | __sock_put(sk); | 1110 | __sock_put(sk); |
1111 | } | 1111 | } |