Skip to content

Commit 7b46ac4

Browse files
committed
inetpeer: Don't disable BH for initial fast RCU lookup.
If modifications on other cpus are ok, then modifications to the tree during lookup done by the local cpu are ok too. Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5217e87 commit 7b46ac4

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

‎net/ipv4/inetpeer.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,16 +206,16 @@ static int addr_compare(const struct inetpeer_addr *a,
206206
})
207207

208208
/*
209-
* Called with rcu_read_lock_bh()
209+
* Called with rcu_read_lock()
210210
* Because we hold no lock against a writer, its quite possible we fall
211211
* in an endless loop.
212212
* But every pointer we follow is guaranteed to be valid thanks to RCU.
213213
* We exit from this function if number of links exceeds PEER_MAXDEPTH
214214
*/
215-
static struct inet_peer *lookup_rcu_bh(const struct inetpeer_addr *daddr,
216-
struct inet_peer_base *base)
215+
static struct inet_peer *lookup_rcu(const struct inetpeer_addr *daddr,
216+
struct inet_peer_base *base)
217217
{
218-
struct inet_peer *u = rcu_dereference_bh(base->root);
218+
struct inet_peer *u = rcu_dereference(base->root);
219219
int count = 0;
220220

221221
while (u != peer_avl_empty) {
@@ -231,9 +231,9 @@ static struct inet_peer *lookup_rcu_bh(const struct inetpeer_addr *daddr,
231231
return u;
232232
}
233233
if (cmp == -1)
234-
u = rcu_dereference_bh(u->avl_left);
234+
u = rcu_dereference(u->avl_left);
235235
else
236-
u = rcu_dereference_bh(u->avl_right);
236+
u = rcu_dereference(u->avl_right);
237237
if (unlikely(++count == PEER_MAXDEPTH))
238238
break;
239239
}
@@ -470,11 +470,11 @@ struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create)
470470
/* Look up for the address quickly, lockless.
471471
* Because of a concurrent writer, we might not find an existing entry.
472472
*/
473-
rcu_read_lock_bh();
473+
rcu_read_lock();
474474
sequence = read_seqbegin(&base->lock);
475-
p = lookup_rcu_bh(daddr, base);
475+
p = lookup_rcu(daddr, base);
476476
invalidated = read_seqretry(&base->lock, sequence);
477-
rcu_read_unlock_bh();
477+
rcu_read_unlock();
478478

479479
if (p) {
480480
/* The existing node has been found.

0 commit comments

Comments
 (0)