diff options
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index a849bb15d864..cd76b3cb7092 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -131,8 +131,8 @@ static int ip_rt_min_advmss __read_mostly = 256; | |||
131 | static int ip_rt_secret_interval __read_mostly = 10 * 60 * HZ; | 131 | static int ip_rt_secret_interval __read_mostly = 10 * 60 * HZ; |
132 | static int rt_chain_length_max __read_mostly = 20; | 132 | static int rt_chain_length_max __read_mostly = 20; |
133 | 133 | ||
134 | static void rt_worker_func(struct work_struct *work); | 134 | static struct delayed_work expires_work; |
135 | static DECLARE_DELAYED_WORK(expires_work, rt_worker_func); | 135 | static unsigned long expires_ljiffies; |
136 | 136 | ||
137 | /* | 137 | /* |
138 | * Interface to generic destination cache. | 138 | * Interface to generic destination cache. |
@@ -787,9 +787,12 @@ static void rt_check_expire(void) | |||
787 | struct rtable *rth, *aux, **rthp; | 787 | struct rtable *rth, *aux, **rthp; |
788 | unsigned long samples = 0; | 788 | unsigned long samples = 0; |
789 | unsigned long sum = 0, sum2 = 0; | 789 | unsigned long sum = 0, sum2 = 0; |
790 | unsigned long delta; | ||
790 | u64 mult; | 791 | u64 mult; |
791 | 792 | ||
792 | mult = ((u64)ip_rt_gc_interval) << rt_hash_log; | 793 | delta = jiffies - expires_ljiffies; |
794 | expires_ljiffies = jiffies; | ||
795 | mult = ((u64)delta) << rt_hash_log; | ||
793 | if (ip_rt_gc_timeout > 1) | 796 | if (ip_rt_gc_timeout > 1) |
794 | do_div(mult, ip_rt_gc_timeout); | 797 | do_div(mult, ip_rt_gc_timeout); |
795 | goal = (unsigned int)mult; | 798 | goal = (unsigned int)mult; |
@@ -3397,6 +3400,8 @@ int __init ip_rt_init(void) | |||
3397 | /* All the timers, started at system startup tend | 3400 | /* All the timers, started at system startup tend |
3398 | to synchronize. Perturb it a bit. | 3401 | to synchronize. Perturb it a bit. |
3399 | */ | 3402 | */ |
3403 | INIT_DELAYED_WORK_DEFERRABLE(&expires_work, rt_worker_func); | ||
3404 | expires_ljiffies = jiffies; | ||
3400 | schedule_delayed_work(&expires_work, | 3405 | schedule_delayed_work(&expires_work, |
3401 | net_random() % ip_rt_gc_interval + ip_rt_gc_interval); | 3406 | net_random() % ip_rt_gc_interval + ip_rt_gc_interval); |
3402 | 3407 | ||