Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 236664
b: refs/heads/master
c: 6193d2b
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jan 21, 2011
1 parent 64870c5 commit 5ac3674
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 753ea8e96258d87be1951083b5c4a368524515f1
refs/heads/master: 6193d2be290990b789021e06fa770ecb45319f2d
13 changes: 7 additions & 6 deletions trunk/net/core/neighbour.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,22 +316,22 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int entries)
{
size_t size = entries * sizeof(struct neighbour *);
struct neigh_hash_table *ret;
struct neighbour **buckets;
struct neighbour __rcu **buckets;

ret = kmalloc(sizeof(*ret), GFP_ATOMIC);
if (!ret)
return NULL;
if (size <= PAGE_SIZE)
buckets = kzalloc(size, GFP_ATOMIC);
else
buckets = (struct neighbour **)
buckets = (struct neighbour __rcu **)
__get_free_pages(GFP_ATOMIC | __GFP_ZERO,
get_order(size));
if (!buckets) {
kfree(ret);
return NULL;
}
rcu_assign_pointer(ret->hash_buckets, buckets);
ret->hash_buckets = buckets;
ret->hash_mask = entries - 1;
get_random_bytes(&ret->hash_rnd, sizeof(ret->hash_rnd));
return ret;
Expand All @@ -343,7 +343,7 @@ static void neigh_hash_free_rcu(struct rcu_head *head)
struct neigh_hash_table,
rcu);
size_t size = (nht->hash_mask + 1) * sizeof(struct neighbour *);
struct neighbour **buckets = nht->hash_buckets;
struct neighbour __rcu **buckets = nht->hash_buckets;

if (size <= PAGE_SIZE)
kfree(buckets);
Expand Down Expand Up @@ -1540,7 +1540,7 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
panic("cannot create neighbour proc dir entry");
#endif

tbl->nht = neigh_hash_alloc(8);
RCU_INIT_POINTER(tbl->nht, neigh_hash_alloc(8));

phsize = (PNEIGH_HASHMASK + 1) * sizeof(struct pneigh_entry *);
tbl->phash_buckets = kzalloc(phsize, GFP_KERNEL);
Expand Down Expand Up @@ -1602,7 +1602,8 @@ int neigh_table_clear(struct neigh_table *tbl)
}
write_unlock(&neigh_tbl_lock);

call_rcu(&tbl->nht->rcu, neigh_hash_free_rcu);
call_rcu(&rcu_dereference_protected(tbl->nht, 1)->rcu,
neigh_hash_free_rcu);
tbl->nht = NULL;

kfree(tbl->phash_buckets);
Expand Down

0 comments on commit 5ac3674

Please sign in to comment.