public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Alexander Duyck <alexander.duyck@gmail.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH 00/16] Remove the ipv4 routing cache
Date: Thu, 26 Jul 2012 19:43:53 +0200	[thread overview]
Message-ID: <1343324633.2626.11801.camel@edumazet-glaptop> (raw)
In-Reply-To: <1343324175.2626.11790.camel@edumazet-glaptop>

On Thu, 2012-07-26 at 19:36 +0200, Eric Dumazet wrote:
> On Thu, 2012-07-26 at 19:31 +0200, Eric Dumazet wrote:
> > On Thu, 2012-07-26 at 10:18 -0700, Alexander Duyck wrote:
> > 
> > > I tested this patch and it looks like it runs, but still has the same
> > > performance issue.  I did some digging into the annotation for
> > > ip_route_intput_noref and it seems like the issue is that I am hitting
> > > the dst_hold call in  __mkroute_input.
> > 
> > David suggested a percpu cache.
> > 
> > nh_rth_input would be allocated by alloc_percpu(struct dst *)
> > 
> > I can work on this.
> 
> Wait a minute, on input we should use the noref trick too.
> 

Something like : (on top of latest David patch)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 7a591aa..d5d2ad1 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1371,8 +1371,7 @@ static void ip_handle_martian_source(struct net_device *dev,
 static int __mkroute_input(struct sk_buff *skb,
 			   const struct fib_result *res,
 			   struct in_device *in_dev,
-			   __be32 daddr, __be32 saddr, u32 tos,
-			   struct rtable **result)
+			   __be32 daddr, __be32 saddr, u32 tos)
 {
 	struct rtable *rth;
 	int err;
@@ -1423,7 +1422,7 @@ static int __mkroute_input(struct sk_buff *skb,
 		if (!itag) {
 			rth = FIB_RES_NH(*res).nh_rth_input;
 			if (rt_cache_valid(rth)) {
-				dst_hold(&rth->dst);
+				skb_dst_set_noref(skb, &rth->dst);
 				goto out;
 			}
 			do_cache = true;
@@ -1451,7 +1450,6 @@ static int __mkroute_input(struct sk_buff *skb,
 
 	rt_set_nexthop(rth, daddr, res, NULL, res->fi, res->type, itag);
 out:
-	*result = rth;
 	err = 0;
  cleanup:
 	return err;
@@ -1463,21 +1461,13 @@ static int ip_mkroute_input(struct sk_buff *skb,
 			    struct in_device *in_dev,
 			    __be32 daddr, __be32 saddr, u32 tos)
 {
-	struct rtable *rth = NULL;
-	int err;
-
 #ifdef CONFIG_IP_ROUTE_MULTIPATH
 	if (res->fi && res->fi->fib_nhs > 1)
 		fib_select_multipath(res);
 #endif
 
 	/* create a routing cache entry */
-	err = __mkroute_input(skb, res, in_dev, daddr, saddr, tos, &rth);
-	if (err)
-		return err;
-
-	skb_dst_set(skb, &rth->dst);
-	return 0;
+	return __mkroute_input(skb, res, in_dev, daddr, saddr, tos);
 }
 
 /*

  reply	other threads:[~2012-07-26 17:43 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-20 21:25 [PATCH 00/16] Remove the ipv4 routing cache David Miller
2012-07-20 22:05 ` Eric Dumazet
2012-07-20 22:42   ` Eric Dumazet
2012-07-20 22:50     ` David Miller
2012-07-20 22:54       ` David Miller
2012-07-20 23:13         ` David Miller
2012-07-21  5:40           ` Eric Dumazet
2012-07-22  7:47 ` Vijay Subramanian
2012-07-22 19:42   ` David Miller
2012-07-23  0:39 ` David Miller
2012-07-23  7:15   ` Eric Dumazet
2012-07-23 17:54     ` Paweł Staszewski
2012-07-23 20:10       ` David Miller
2012-07-26 17:02       ` Eric Dumazet
2012-07-25 23:02 ` Alexander Duyck
2012-07-25 23:17   ` David Miller
2012-07-25 23:39     ` David Miller
2012-07-26  0:54       ` David Miller
2012-07-26  2:30         ` Alexander Duyck
2012-07-26  5:32           ` David Miller
2012-07-26  8:13         ` Eric Dumazet
2012-07-26  8:18           ` David Miller
2012-07-26  8:27             ` Eric Dumazet
2012-07-26  8:47               ` David Miller
2012-07-26  9:12                 ` Eric Dumazet
2012-07-26 17:18                 ` Alexander Duyck
2012-07-26 17:30                   ` Eric Dumazet
2012-07-26 17:36                     ` Eric Dumazet
2012-07-26 17:43                       ` Eric Dumazet [this message]
2012-07-26 17:48                         ` Eric Dumazet
2012-07-26 18:26                           ` Alexander Duyck
2012-07-26 21:06                             ` David Miller
2012-07-26 22:03                               ` Alexander Duyck
2012-07-26 22:13                                 ` Stephen Hemminger
2012-07-26 22:19                                   ` Eric Dumazet
2012-07-26 22:48                                   ` David Miller
2012-07-26 22:53                                 ` David Miller
2012-07-27  2:14                                   ` Alexander Duyck
2012-07-27  3:08                                     ` David Miller
2012-07-27  6:02                                       ` David Miller
2012-07-27 10:01                                         ` Eric Dumazet
2012-07-27 14:53                                           ` Eric W. Biederman
2012-07-27 15:12                                             ` Eric Dumazet
2012-07-27 16:23                                               ` Eric W. Biederman
2012-07-27 16:28                                                 ` Eric Dumazet
2012-07-27 19:06                                                   ` Alexander Duyck
2012-07-28  4:15                                         ` David Miller
2012-07-28  5:45                                           ` Alexander Duyck
2012-07-26 18:06                         ` Alexander Duyck
2012-07-26 21:00                         ` David Miller
2012-07-26 20:59                   ` David Miller

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=1343324633.2626.11801.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=alexander.duyck@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@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