From 24bc83a5fab01bb2bd4490eb83a68973e163e7bc Mon Sep 17 00:00:00 2001 From: Alexey Kuznetsov Date: Fri, 15 Aug 2003 22:08:52 -0700 Subject: [PATCH] [IPV4]: Fix rt_score() and usage when purging rtcache hash chains. --- net/ipv4/route.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index e60f43256f7ac..5ee3e309f4c8f 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -463,7 +463,9 @@ out: return ret; */ static inline u32 rt_score(struct rtable *rt) { - u32 score = rt->u.dst.__use; + u32 score = jiffies - rt->u.dst.lastuse; + + score = ~score & ~(3<<30); if (rt_valuable(rt)) score |= (1<<31); @@ -805,8 +807,7 @@ restart: * The second limit is less certain. At the moment it allows * only 2 entries per bucket. We will see. */ - if (chain_length > ip_rt_gc_elasticity || - (chain_length > 1 && !(min_score & (1<<31)))) { + if (chain_length > ip_rt_gc_elasticity) { *candp = cand->u.rt_next; rt_free(cand); } -- 2.53.0