diff options
author | Eric Dumazet <edumazet@google.com> | 2017-10-20 20:29:56 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-22 04:13:19 +0200 |
commit | 81d98fa4df3d1683b3ef21e8a7a0ccac7874f0de (patch) | |
tree | 663e667174987317f515eb313db6082c39c44401 /drivers/net/tun.c | |
parent | tun: do not block BH again in tun_flow_cleanup() (diff) | |
download | linux-81d98fa4df3d1683b3ef21e8a7a0ccac7874f0de.tar.xz linux-81d98fa4df3d1683b3ef21e8a7a0ccac7874f0de.zip |
tun: avoid extra timer schedule in tun_flow_cleanup()
If tun_flow_cleanup() deleted all flows, no need to
arm the timer again. It will be armed next time
tun_flow_update() is called.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r-- | drivers/net/tun.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index f9541f7f9fb7..995887de5a98 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -461,11 +461,14 @@ static void tun_flow_cleanup(unsigned long data) hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) { unsigned long this_timer; - count++; + this_timer = e->updated + delay; - if (time_before_eq(this_timer, jiffies)) + if (time_before_eq(this_timer, jiffies)) { tun_flow_delete(tun, e); - else if (time_before(this_timer, next_timer)) + continue; + } + count++; + if (time_before(this_timer, next_timer)) next_timer = this_timer; } } |