neigh: RCU conversion of struct neighbour
This is the second step for neighbour RCU conversion.
(first was commit d6bf7817
: RCU conversion of neigh hash table)
neigh_lookup() becomes lockless, but still take a reference on found
neighbour. (no more read_lock()/read_unlock() on tbl->lock)
struct neighbour gets an additional rcu_head field and is freed after an
RCU grace period.
Future work would need to eventually not take a reference on neighbour
for temporary dst (DST_NOCACHE), but this would need dst->_neighbour to
use a noref bit like we did for skb->_dst.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
546add7946
commit
767e97e1e0
@@ -91,7 +91,7 @@ struct neigh_statistics {
|
||||
#define NEIGH_CACHE_STAT_INC(tbl, field) this_cpu_inc((tbl)->stats->field)
|
||||
|
||||
struct neighbour {
|
||||
struct neighbour *next;
|
||||
struct neighbour __rcu *next;
|
||||
struct neigh_table *tbl;
|
||||
struct neigh_parms *parms;
|
||||
struct net_device *dev;
|
||||
@@ -111,6 +111,7 @@ struct neighbour {
|
||||
struct sk_buff_head arp_queue;
|
||||
struct timer_list timer;
|
||||
const struct neigh_ops *ops;
|
||||
struct rcu_head rcu;
|
||||
u8 primary_key[0];
|
||||
};
|
||||
|
||||
@@ -139,7 +140,7 @@ struct pneigh_entry {
|
||||
*/
|
||||
|
||||
struct neigh_hash_table {
|
||||
struct neighbour **hash_buckets;
|
||||
struct neighbour __rcu **hash_buckets;
|
||||
unsigned int hash_mask;
|
||||
__u32 hash_rnd;
|
||||
struct rcu_head rcu;
|
||||
|
Reference in New Issue
Block a user