[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20110128.143512.102553352.davem@davemloft.net>
Date: Fri, 28 Jan 2011 14:35:12 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: netdev@...r.kernel.org
Subject: [PATCH 3/3] ipv4: If fib metrics are default, no need to grab ref
to FIB info.
The fib metric memory in this case is static in the kernel image,
so we don't need to reference count it since it's never going
to go away on us.
Signed-off-by: David S. Miller <davem@...emloft.net>
---
net/ipv4/route.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index dd57f48..b1e5d3a 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1861,8 +1861,10 @@ static void rt_init_metrics(struct rtable *rt, struct fib_info *fi)
{
if (!(rt->fl.flags & FLOWI_FLAG_PRECOW_METRICS)) {
no_cow:
- rt->fi = fi;
- atomic_inc(&fi->fib_clntref);
+ if (fi->fib_metrics != (u32 *) dst_default_metrics) {
+ rt->fi = fi;
+ atomic_inc(&fi->fib_clntref);
+ }
dst_init_metrics(&rt->dst, fi->fib_metrics, true);
} else {
struct inet_peer *peer;
--
1.7.3.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists