Skip to content

Commit df67e6c

Browse files
committed
ipv4: Remove unnecessary code from rt_check_expire().
IPv4 routing cache entries no longer use dst->expires, because the metrics, PMTU, and redirect information are stored in the inetpeer cache. Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 29cb99d commit df67e6c

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

net/ipv4/route.c

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -870,34 +870,22 @@ static void rt_check_expire(void)
870870
while ((rth = rcu_dereference_protected(*rthp,
871871
lockdep_is_held(rt_hash_lock_addr(i)))) != NULL) {
872872
prefetch(rth->dst.rt_next);
873-
if (rt_is_expired(rth)) {
873+
if (rt_is_expired(rth) ||
874+
rt_may_expire(rth, tmo, ip_rt_gc_timeout)) {
874875
*rthp = rth->dst.rt_next;
875876
rt_free(rth);
876877
continue;
877878
}
878-
if (rth->dst.expires) {
879-
/* Entry is expired even if it is in use */
880-
if (time_before_eq(jiffies, rth->dst.expires)) {
881-
nofree:
882-
tmo >>= 1;
883-
rthp = &rth->dst.rt_next;
884-
/*
885-
* We only count entries on
886-
* a chain with equal hash inputs once
887-
* so that entries for different QOS
888-
* levels, and other non-hash input
889-
* attributes don't unfairly skew
890-
* the length computation
891-
*/
892-
length += has_noalias(rt_hash_table[i].chain, rth);
893-
continue;
894-
}
895-
} else if (!rt_may_expire(rth, tmo, ip_rt_gc_timeout))
896-
goto nofree;
897879

898-
/* Cleanup aged off entries. */
899-
*rthp = rth->dst.rt_next;
900-
rt_free(rth);
880+
/* We only count entries on a chain with equal
881+
* hash inputs once so that entries for
882+
* different QOS levels, and other non-hash
883+
* input attributes don't unfairly skew the
884+
* length computation
885+
*/
886+
tmo >>= 1;
887+
rthp = &rth->dst.rt_next;
888+
length += has_noalias(rt_hash_table[i].chain, rth);
901889
}
902890
spin_unlock_bh(rt_hash_lock_addr(i));
903891
sum += length;

0 commit comments

Comments
 (0)