aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>2013-01-22 00:20:05 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-22 14:25:28 -0500
commit2724680bceee94eac391552863771af105a7355c (patch)
treedee52affa20715488fd361c370a4fc70ce05591c /net/core
parent360eb5da665566a110993c58ed2a63e98f6720bf (diff)
neigh: Keep neighbour cache entries if number of them is small enough.
Since we have removed NCE (Neighbour Cache Entry) reference from routing entries, the only refcnt holders of an NCE are its timer (if running) and its owner table, in usual cases. As a result, neigh_periodic_work() purges NCEs over and over again even for gateways. It does not make sense to purge entries, if number of them is very small, so keep them. The minimum number of entries to keep is specified by gc_thresh1. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/neighbour.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index c815f285e5ab..7bd0eedb357f 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -778,6 +778,9 @@ static void neigh_periodic_work(struct work_struct *work)
778 nht = rcu_dereference_protected(tbl->nht, 778 nht = rcu_dereference_protected(tbl->nht,
779 lockdep_is_held(&tbl->lock)); 779 lockdep_is_held(&tbl->lock));
780 780
781 if (atomic_read(&tbl->entries) < tbl->gc_thresh1)
782 goto out;
783
781 /* 784 /*
782 * periodically recompute ReachableTime from random function 785 * periodically recompute ReachableTime from random function
783 */ 786 */
@@ -832,6 +835,7 @@ next_elt:
832 nht = rcu_dereference_protected(tbl->nht, 835 nht = rcu_dereference_protected(tbl->nht,
833 lockdep_is_held(&tbl->lock)); 836 lockdep_is_held(&tbl->lock));
834 } 837 }
838out:
835 /* Cycle through all hash buckets every base_reachable_time/2 ticks. 839 /* Cycle through all hash buckets every base_reachable_time/2 ticks.
836 * ARP entry timeouts range from 1/2 base_reachable_time to 3/2 840 * ARP entry timeouts range from 1/2 base_reachable_time to 3/2
837 * base_reachable_time. 841 * base_reachable_time.