diff options
Diffstat (limited to 'net/ipv4/inetpeer.c')
-rw-r--r-- | net/ipv4/inetpeer.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index 95473953c406..f84ba9c96551 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
22 | #include <linux/net.h> | 22 | #include <linux/net.h> |
23 | #include <net/ip.h> | ||
23 | #include <net/inetpeer.h> | 24 | #include <net/inetpeer.h> |
24 | 25 | ||
25 | /* | 26 | /* |
@@ -72,7 +73,7 @@ | |||
72 | /* Exported for inet_getid inline function. */ | 73 | /* Exported for inet_getid inline function. */ |
73 | DEFINE_SPINLOCK(inet_peer_idlock); | 74 | DEFINE_SPINLOCK(inet_peer_idlock); |
74 | 75 | ||
75 | static kmem_cache_t *peer_cachep; | 76 | static kmem_cache_t *peer_cachep __read_mostly; |
76 | 77 | ||
77 | #define node_height(x) x->avl_height | 78 | #define node_height(x) x->avl_height |
78 | static struct inet_peer peer_fake_node = { | 79 | static struct inet_peer peer_fake_node = { |
@@ -450,11 +451,12 @@ static void peer_check_expire(unsigned long dummy) | |||
450 | /* Trigger the timer after inet_peer_gc_mintime .. inet_peer_gc_maxtime | 451 | /* Trigger the timer after inet_peer_gc_mintime .. inet_peer_gc_maxtime |
451 | * interval depending on the total number of entries (more entries, | 452 | * interval depending on the total number of entries (more entries, |
452 | * less interval). */ | 453 | * less interval). */ |
453 | peer_periodic_timer.expires = jiffies | 454 | if (peer_total >= inet_peer_threshold) |
454 | + inet_peer_gc_maxtime | 455 | peer_periodic_timer.expires = jiffies + inet_peer_gc_mintime; |
455 | - (inet_peer_gc_maxtime - inet_peer_gc_mintime) / HZ * | 456 | else |
456 | peer_total / inet_peer_threshold * HZ; | 457 | peer_periodic_timer.expires = jiffies |
458 | + inet_peer_gc_maxtime | ||
459 | - (inet_peer_gc_maxtime - inet_peer_gc_mintime) / HZ * | ||
460 | peer_total / inet_peer_threshold * HZ; | ||
457 | add_timer(&peer_periodic_timer); | 461 | add_timer(&peer_periodic_timer); |
458 | } | 462 | } |
459 | |||
460 | EXPORT_SYMBOL(inet_peer_idlock); | ||