git: 2666f081bac0 - stable/12 - ip_reass: do less work in ipreass_slowtimo if possible
Mateusz Guzik
mjg at FreeBSD.org
Wed Aug 18 09:50:47 UTC 2021
The branch stable/12 has been updated by mjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=2666f081bac0c9225b7db2cb7a6776ed52bd568a
commit 2666f081bac0c9225b7db2cb7a6776ed52bd568a
Author: Mateusz Guzik <mjg at FreeBSD.org>
AuthorDate: 2021-08-13 09:32:16 +0000
Commit: Mateusz Guzik <mjg at FreeBSD.org>
CommitDate: 2021-08-18 09:48:16 +0000
ip_reass: do less work in ipreass_slowtimo if possible
ipreass_slowtimo avoidably uses CPU on otherwise idle boxes
Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31526
(cherry picked from commit 3be3cbe06d6107486d67d8eb80480d34d084c39c)
---
sys/netinet/ip_reass.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sys/netinet/ip_reass.c b/sys/netinet/ip_reass.c
index 5aa75474ad60..0d5300d7382b 100644
--- a/sys/netinet/ip_reass.c
+++ b/sys/netinet/ip_reass.c
@@ -592,11 +592,16 @@ ipreass_slowtimo(void)
{
struct ipq *fp, *tmp;
+ if (atomic_load_int(&nfrags) == 0)
+ return;
+
for (int i = 0; i < IPREASS_NHASH; i++) {
+ if (TAILQ_EMPTY(&V_ipq[i].head))
+ continue;
IPQ_LOCK(i);
TAILQ_FOREACH_SAFE(fp, &V_ipq[i].head, ipq_list, tmp)
if (--fp->ipq_ttl == 0)
- ipq_timeout(&V_ipq[i], fp);
+ ipq_timeout(&V_ipq[i], fp);
IPQ_UNLOCK(i);
}
}
More information about the dev-commits-src-all
mailing list