Commit 6445be80 authored by Robert Olsson's avatar Robert Olsson Committed by David S. Miller

IPV4: Add statistics for route cache GC monitoring.

parent e53dd853
...@@ -110,6 +110,10 @@ struct rt_cache_stat ...@@ -110,6 +110,10 @@ struct rt_cache_stat
unsigned int out_hit; unsigned int out_hit;
unsigned int out_slow_tot; unsigned int out_slow_tot;
unsigned int out_slow_mc; unsigned int out_slow_mc;
unsigned int gc_total;
unsigned int gc_ignored;
unsigned int gc_goal_miss;
unsigned int gc_dst_overflow;
} ____cacheline_aligned_in_smp; } ____cacheline_aligned_in_smp;
extern struct ip_rt_acct *ip_rt_acct; extern struct ip_rt_acct *ip_rt_acct;
......
...@@ -286,7 +286,7 @@ static int rt_cache_stat_get_info(char *buffer, char **start, off_t offset, int ...@@ -286,7 +286,7 @@ static int rt_cache_stat_get_info(char *buffer, char **start, off_t offset, int
for (lcpu = 0; lcpu < smp_num_cpus; lcpu++) { for (lcpu = 0; lcpu < smp_num_cpus; lcpu++) {
i = cpu_logical_map(lcpu); i = cpu_logical_map(lcpu);
len += sprintf(buffer+len, "%08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x\n", len += sprintf(buffer+len, "%08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x \n",
dst_entries, dst_entries,
rt_cache_stat[i].in_hit, rt_cache_stat[i].in_hit,
rt_cache_stat[i].in_slow_tot, rt_cache_stat[i].in_slow_tot,
...@@ -298,7 +298,13 @@ static int rt_cache_stat_get_info(char *buffer, char **start, off_t offset, int ...@@ -298,7 +298,13 @@ static int rt_cache_stat_get_info(char *buffer, char **start, off_t offset, int
rt_cache_stat[i].out_hit, rt_cache_stat[i].out_hit,
rt_cache_stat[i].out_slow_tot, rt_cache_stat[i].out_slow_tot,
rt_cache_stat[i].out_slow_mc rt_cache_stat[i].out_slow_mc,
rt_cache_stat[i].gc_total,
rt_cache_stat[i].gc_ignored,
rt_cache_stat[i].gc_goal_miss,
rt_cache_stat[i].gc_dst_overflow
); );
} }
len -= offset; len -= offset;
...@@ -499,9 +505,14 @@ static int rt_garbage_collect(void) ...@@ -499,9 +505,14 @@ static int rt_garbage_collect(void)
* Garbage collection is pretty expensive, * Garbage collection is pretty expensive,
* do not make it too frequently. * do not make it too frequently.
*/ */
rt_cache_stat[smp_processor_id()].gc_total++;
if (now - last_gc < ip_rt_gc_min_interval && if (now - last_gc < ip_rt_gc_min_interval &&
atomic_read(&ipv4_dst_ops.entries) < ip_rt_max_size) atomic_read(&ipv4_dst_ops.entries) < ip_rt_max_size) {
rt_cache_stat[smp_processor_id()].gc_ignored++;
goto out; goto out;
}
/* Calculate number of entries, which we want to expire now. */ /* Calculate number of entries, which we want to expire now. */
goal = atomic_read(&ipv4_dst_ops.entries) - goal = atomic_read(&ipv4_dst_ops.entries) -
...@@ -567,6 +578,8 @@ static int rt_garbage_collect(void) ...@@ -567,6 +578,8 @@ static int rt_garbage_collect(void)
We will not spin here for long time in any case. We will not spin here for long time in any case.
*/ */
rt_cache_stat[smp_processor_id()].gc_goal_miss++;
if (expire == 0) if (expire == 0)
break; break;
...@@ -584,6 +597,7 @@ static int rt_garbage_collect(void) ...@@ -584,6 +597,7 @@ static int rt_garbage_collect(void)
goto out; goto out;
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING "dst cache overflow\n"); printk(KERN_WARNING "dst cache overflow\n");
rt_cache_stat[smp_processor_id()].gc_dst_overflow++;
return 1; return 1;
work_done: work_done:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment