diff options
author | Denis Lunev <den@sw.ru> | 2005-07-30 20:47:25 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-07-30 20:47:25 -0400 |
commit | f0098f7863f814a5adc0b9cb271605d063cad7fa (patch) | |
tree | 7477022770edd99422586372147e9b0f48de4c63 /net/core | |
parent | db44575f6fd55df6ff67ddd21f7ad5be5a741136 (diff) |
[NET] Fix too aggressive backoff in dst garbage collection
The bug is evident when it is seen once. dst gc timer was backed off,
when gc queue is not empty. But this means that timer quickly backs off,
if at least one destination remains in use. Normally, the bug is invisible,
because adding new dst entry to queue cancels the backoff. But it shots
deadly with destination cache overflow when new destinations are not released
for long time f.e. after an interface goes down.
The fix is to cancel backoff when something was released.
Signed-off-by: Denis Lunev <den@sw.ru>
Signed-off-by: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dst.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/net/core/dst.c b/net/core/dst.c index fc434ade5270..334790da9f16 100644 --- a/net/core/dst.c +++ b/net/core/dst.c | |||
@@ -45,6 +45,7 @@ static struct timer_list dst_gc_timer = | |||
45 | static void dst_run_gc(unsigned long dummy) | 45 | static void dst_run_gc(unsigned long dummy) |
46 | { | 46 | { |
47 | int delayed = 0; | 47 | int delayed = 0; |
48 | int work_performed; | ||
48 | struct dst_entry * dst, **dstp; | 49 | struct dst_entry * dst, **dstp; |
49 | 50 | ||
50 | if (!spin_trylock(&dst_lock)) { | 51 | if (!spin_trylock(&dst_lock)) { |
@@ -52,9 +53,9 @@ static void dst_run_gc(unsigned long dummy) | |||
52 | return; | 53 | return; |
53 | } | 54 | } |
54 | 55 | ||
55 | |||
56 | del_timer(&dst_gc_timer); | 56 | del_timer(&dst_gc_timer); |
57 | dstp = &dst_garbage_list; | 57 | dstp = &dst_garbage_list; |
58 | work_performed = 0; | ||
58 | while ((dst = *dstp) != NULL) { | 59 | while ((dst = *dstp) != NULL) { |
59 | if (atomic_read(&dst->__refcnt)) { | 60 | if (atomic_read(&dst->__refcnt)) { |
60 | dstp = &dst->next; | 61 | dstp = &dst->next; |
@@ -62,6 +63,7 @@ static void dst_run_gc(unsigned long dummy) | |||
62 | continue; | 63 | continue; |
63 | } | 64 | } |
64 | *dstp = dst->next; | 65 | *dstp = dst->next; |
66 | work_performed = 1; | ||
65 | 67 | ||
66 | dst = dst_destroy(dst); | 68 | dst = dst_destroy(dst); |
67 | if (dst) { | 69 | if (dst) { |
@@ -86,9 +88,14 @@ static void dst_run_gc(unsigned long dummy) | |||
86 | dst_gc_timer_inc = DST_GC_MAX; | 88 | dst_gc_timer_inc = DST_GC_MAX; |
87 | goto out; | 89 | goto out; |
88 | } | 90 | } |
89 | if ((dst_gc_timer_expires += dst_gc_timer_inc) > DST_GC_MAX) | 91 | if (!work_performed) { |
90 | dst_gc_timer_expires = DST_GC_MAX; | 92 | if ((dst_gc_timer_expires += dst_gc_timer_inc) > DST_GC_MAX) |
91 | dst_gc_timer_inc += DST_GC_INC; | 93 | dst_gc_timer_expires = DST_GC_MAX; |
94 | dst_gc_timer_inc += DST_GC_INC; | ||
95 | } else { | ||
96 | dst_gc_timer_inc = DST_GC_INC; | ||
97 | dst_gc_timer_expires = DST_GC_MIN; | ||
98 | } | ||
92 | dst_gc_timer.expires = jiffies + dst_gc_timer_expires; | 99 | dst_gc_timer.expires = jiffies + dst_gc_timer_expires; |
93 | #if RT_CACHE_DEBUG >= 2 | 100 | #if RT_CACHE_DEBUG >= 2 |
94 | printk("dst_total: %d/%d %ld\n", | 101 | printk("dst_total: %d/%d %ld\n", |