netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: Denys Fedoryshchenko <denys@visp.net.lb>,
	netdev@vger.kernel.org, netfilter-devel@vger.kernel.org
Subject: Re: kernel 2.6.25-rc7 highly unstable on high load
Date: Fri, 28 Mar 2008 16:57:55 +0100	[thread overview]
Message-ID: <47ED1583.5010204@cosmosbay.com> (raw)
In-Reply-To: <47ECA24C.10803@cosmosbay.com>

[-- Attachment #1: Type: text/plain, Size: 878 bytes --]

Eric Dumazet a écrit :
> Denys Fedoryshchenko a écrit :
>> Already patched and tested, it doesn't change anything.
>>
>>   
>
> We still leak dsts somewhere.
>
> You could try git bisect, or try to patch net/core/dst.c so that 
> dst_gc_task() (line 83) displays
> route informations for say 10 first entries found in the dst_busy_list
> (refcnt, interface, source IP, dest IP, things like that) that could 
> ring a bell given your netfilter rules or network conf.

I cooked a patch (untested) to implement this idea :

It should display lines similar to /proc/net/rt_cache (reusing the same 
helper function)

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>

 include/net/dst.h |    2 +
 net/core/dst.c    |    7 ++++++
 net/ipv4/route.c  |   47 ++++++++++++++++++++++++++------------------
 3 files changed, 37 insertions(+), 19 deletions(-)



[-- Attachment #2: show_info.patch --]
[-- Type: text/plain, Size: 4070 bytes --]

diff --git a/include/net/dst.h b/include/net/dst.h
index 002500e..2fe9a6c 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -103,6 +103,8 @@ struct dst_ops
 	void			(*link_failure)(struct sk_buff *);
 	void			(*update_pmtu)(struct dst_entry *dst, u32 mtu);
 	int			(*local_out)(struct sk_buff *skb);
+	size_t			(*info_show)(struct dst_entry *, char *buff,
+					     size_t len);
 	int			entry_size;
 
 	atomic_t		entries;
diff --git a/net/core/dst.c b/net/core/dst.c
index fe03266..08395e8 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -70,6 +70,7 @@ static void dst_gc_task(struct work_struct *work)
 #if RT_CACHE_DEBUG >= 2
 	ktime_t time_start = ktime_get();
 	struct timespec elapsed;
+	char info[128];
 #endif
 
 	mutex_lock(&dst_gc_mutex);
@@ -82,6 +83,12 @@ loop:
 		if (likely(atomic_read(&dst->__refcnt))) {
 			last->next = dst;
 			last = dst;
+#if RT_CACHE_DEBUG >= 2
+			if (delayed < 10 && dst->ops->info_show) {
+				dst->ops->info_show(dst, info, sizeof(info));
+				printk(KERN_DEBUG "dstgc [%d] %s\n", delayed, info);
+			}
+#endif
 			delayed++;
 			continue;
 		}
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 230716c..ef8c3b7 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -148,6 +148,8 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst);
 static void		 ipv4_link_failure(struct sk_buff *skb);
 static void		 ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu);
 static int rt_garbage_collect(struct dst_ops *ops);
+static size_t		 rt_info_show(struct dst_entry *dst,
+				      char *buff, size_t maxlen);
 
 
 static struct dst_ops ipv4_dst_ops = {
@@ -161,6 +163,7 @@ static struct dst_ops ipv4_dst_ops = {
 	.link_failure =		ipv4_link_failure,
 	.update_pmtu =		ip_rt_update_pmtu,
 	.local_out =		ip_local_out,
+	.info_show =		rt_info_show,
 	.entry_size =		sizeof(struct rtable),
 	.entries =		ATOMIC_INIT(0),
 };
@@ -269,6 +272,28 @@ static unsigned int rt_hash_code(u32 daddr, u32 saddr)
 	rt_hash_code((__force u32)(__be32)(daddr),\
 		     (__force u32)(__be32)(saddr) ^ ((idx) << 5))
 
+static size_t rt_info_show(struct dst_entry *dst, char *buff, size_t maxlen)
+{
+	struct rtable *r = (struct rtable *)dst;
+
+	return snprintf(buff, maxlen, "%s\t%08lX\t%08lX\t%8X\t%d\t%u\t%d\t"
+		      "%08lX\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X",
+		r->u.dst.dev ? r->u.dst.dev->name : "*",
+		(unsigned long)r->rt_dst, (unsigned long)r->rt_gateway,
+		r->rt_flags, atomic_read(&r->u.dst.__refcnt),
+		r->u.dst.__use, 0, (unsigned long)r->rt_src,
+		(dst_metric(&r->u.dst, RTAX_ADVMSS) ?
+		     (int)dst_metric(&r->u.dst, RTAX_ADVMSS) + 40 : 0),
+		dst_metric(&r->u.dst, RTAX_WINDOW),
+		(int)((dst_metric(&r->u.dst, RTAX_RTT) >> 3) +
+		      dst_metric(&r->u.dst, RTAX_RTTVAR)),
+		r->fl.fl4_tos,
+		r->u.dst.hh ? atomic_read(&r->u.dst.hh->hh_refcnt) : -1,
+		r->u.dst.hh ? (r->u.dst.hh->hh_output ==
+			       dev_queue_xmit) : 0,
+		r->rt_spec_dst);
+}
+
 #ifdef CONFIG_PROC_FS
 struct rt_cache_iter_state {
 	struct seq_net_private p;
@@ -368,25 +393,9 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
 			   "Metric\tSource\t\tMTU\tWindow\tIRTT\tTOS\tHHRef\t"
 			   "HHUptod\tSpecDst");
 	else {
-		struct rtable *r = v;
-		char temp[256];
-
-		sprintf(temp, "%s\t%08lX\t%08lX\t%8X\t%d\t%u\t%d\t"
-			      "%08lX\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X",
-			r->u.dst.dev ? r->u.dst.dev->name : "*",
-			(unsigned long)r->rt_dst, (unsigned long)r->rt_gateway,
-			r->rt_flags, atomic_read(&r->u.dst.__refcnt),
-			r->u.dst.__use, 0, (unsigned long)r->rt_src,
-			(dst_metric(&r->u.dst, RTAX_ADVMSS) ?
-			     (int)dst_metric(&r->u.dst, RTAX_ADVMSS) + 40 : 0),
-			dst_metric(&r->u.dst, RTAX_WINDOW),
-			(int)((dst_metric(&r->u.dst, RTAX_RTT) >> 3) +
-			      dst_metric(&r->u.dst, RTAX_RTTVAR)),
-			r->fl.fl4_tos,
-			r->u.dst.hh ? atomic_read(&r->u.dst.hh->hh_refcnt) : -1,
-			r->u.dst.hh ? (r->u.dst.hh->hh_output ==
-				       dev_queue_xmit) : 0,
-			r->rt_spec_dst);
+		char temp[128];
+
+		rt_info_show(v, temp, 128);
 		seq_printf(seq, "%-127s\n", temp);
 	}
 	return 0;

  parent reply	other threads:[~2008-03-28 15:57 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-27  6:35 kernel 2.6.25-rc7 highly unstable on high load Denys Fedoryshchenko
2008-03-27  6:40 ` David Miller
2008-03-27  7:03   ` Eric Dumazet
2008-03-27  8:36     ` Denys Fedoryshchenko
2008-03-27  8:48     ` Denys Fedoryshchenko
2008-03-27 14:41     ` Denys Fedoryshchenko
2008-03-27 14:52       ` Eric Dumazet
     [not found]         ` <20080327151520.M89250@visp.net.lb>
2008-03-27 16:07           ` Eric Dumazet
2008-03-27 16:29             ` Eric Dumazet
2008-03-27 18:37             ` Denys Fedoryshchenko
2008-03-27 18:56               ` Eric Dumazet
2008-03-27 19:05                 ` Denis V. Lunev
2008-03-27 22:03                 ` David Miller
2008-03-28  0:47                   ` Denys Fedoryshchenko
2008-03-28  4:50                   ` Denys Fedoryshchenko
2008-03-28  5:25                   ` Denys Fedoryshchenko
2008-03-28  5:49                     ` Eric Dumazet
2008-03-28  7:38                       ` Denys Fedoryshchenko
2008-03-28  7:46                         ` Eric Dumazet
2008-03-28  9:50                           ` Denys Fedoryshchenko
2008-03-28 15:57                           ` Eric Dumazet [this message]
2008-03-28 20:23                             ` Stephen Hemminger
2008-03-28 20:45                               ` Denys Fedoryshchenko
2008-03-28 21:17                                 ` Eric Dumazet
2008-03-28 23:21                                   ` David Miller
2008-03-29  9:35                                     ` Denys Fedoryshchenko
     [not found]                                   ` <20080328220902.M5377@visp.net.lb>
2008-03-29  8:31                                     ` Eric Dumazet
2008-03-27  7:07   ` Denys Fedoryshchenko
2008-03-27 15:01   ` Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47ED1583.5010204@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=denys@visp.net.lb \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).