git: 1922eb3e9c23 - main - protosw: retire pr_slowtimo and pr_fasttimo
Date: Wed, 17 Aug 2022 18:52:20 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=1922eb3e9c23522ed323d022bac8456bf08b97cf
commit 1922eb3e9c23522ed323d022bac8456bf08b97cf
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-08-17 18:50:31 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-08-17 18:50:31 +0000
protosw: retire pr_slowtimo and pr_fasttimo
They were useful many years ago, when the callwheel was not efficient,
and the kernel tried to have as little callout entries scheduled as
possible.
Reviewed by: tuexen, melifaro
Differential revision: https://reviews.freebsd.org/D36163
---
sys/kern/uipc_debug.c | 2 --
sys/kern/uipc_domain.c | 75 --------------------------------------------------
sys/net/route.h | 3 --
sys/sys/protosw.h | 11 --------
4 files changed, 91 deletions(-)
diff --git a/sys/kern/uipc_debug.c b/sys/kern/uipc_debug.c
index b47ae71c84d9..5f96850431a0 100644
--- a/sys/kern/uipc_debug.c
+++ b/sys/kern/uipc_debug.c
@@ -317,8 +317,6 @@ db_print_protosw(struct protosw *pr, const char *prname, int indent)
db_printf("pr_ctloutput: %p ", pr->pr_ctloutput);
db_print_indent(indent);
- db_printf("pr_fasttimo: %p ", pr->pr_fasttimo);
- db_printf("pr_slowtimo: %p ", pr->pr_slowtimo);
db_printf("pr_drain: %p\n", pr->pr_drain);
}
diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c
index 2edd79657d03..20e7c87a6c20 100644
--- a/sys/kern/uipc_domain.c
+++ b/sys/kern/uipc_domain.c
@@ -71,20 +71,6 @@ static void domainfinalize(void *);
SYSINIT(domainfin, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_FIRST, domainfinalize,
NULL);
-static struct callout pffast_callout;
-static struct callout pfslow_callout;
-
-static void pffasttimo(void *);
-static void pfslowtimo(void *);
-
-static struct rmlock pftimo_lock;
-RM_SYSINIT(pftimo_lock, &pftimo_lock, "pftimo");
-
-static LIST_HEAD(, protosw) pffast_list =
- LIST_HEAD_INITIALIZER(pffast_list);
-static LIST_HEAD(, protosw) pfslow_list =
- LIST_HEAD_INITIALIZER(pfslow_list);
-
struct domain *domains; /* registered protocol domains */
int domain_init_status = 0;
static struct mtx dom_mtx; /* domain list lock */
@@ -192,12 +178,6 @@ domain_init(void *arg)
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) {
pr_usrreqs_init(pr);
- rm_wlock(&pftimo_lock);
- if (pr->pr_fasttimo != NULL)
- LIST_INSERT_HEAD(&pffast_list, pr, pr_fasttimos);
- if (pr->pr_slowtimo != NULL)
- LIST_INSERT_HEAD(&pfslow_list, pr, pr_slowtimos);
- rm_wunlock(&pftimo_lock);
}
/*
@@ -270,9 +250,6 @@ domaininit(void *dummy)
if (max_linkhdr < 16) /* XXX */
max_linkhdr = 16;
- callout_init(&pffast_callout, 1);
- callout_init(&pfslow_callout, 1);
-
mtx_lock(&dom_mtx);
KASSERT(domain_init_status == 0, ("domaininit called too late!"));
domain_init_status = 1;
@@ -288,9 +265,6 @@ domainfinalize(void *dummy)
KASSERT(domain_init_status == 1, ("domainfinalize called too late!"));
domain_init_status = 2;
mtx_unlock(&dom_mtx);
-
- callout_reset(&pffast_callout, 1, pffasttimo, NULL);
- callout_reset(&pfslow_callout, 1, pfslowtimo, NULL);
}
struct domain *
@@ -403,12 +377,6 @@ pf_proto_register(int family, struct protosw *npr)
bcopy(npr, fpr, sizeof(*fpr));
pr_usrreqs_init(fpr);
- rm_wlock(&pftimo_lock);
- if (fpr->pr_fasttimo != NULL)
- LIST_INSERT_HEAD(&pffast_list, fpr, pr_fasttimos);
- if (fpr->pr_slowtimo != NULL)
- LIST_INSERT_HEAD(&pfslow_list, fpr, pr_slowtimos);
- rm_wunlock(&pftimo_lock);
/* Job is done, no more protection required. */
mtx_unlock(&dom_mtx);
@@ -461,21 +429,12 @@ pf_proto_unregister(int family, int protocol, int type)
return (EPROTONOSUPPORT);
}
- rm_wlock(&pftimo_lock);
- if (dpr->pr_fasttimo != NULL)
- LIST_REMOVE(dpr, pr_fasttimos);
- if (dpr->pr_slowtimo != NULL)
- LIST_REMOVE(dpr, pr_slowtimos);
- rm_wunlock(&pftimo_lock);
-
/* De-orbit the protocol and make the slot available again. */
dpr->pr_type = 0;
dpr->pr_domain = dp;
dpr->pr_protocol = PROTO_SPACER;
dpr->pr_flags = 0;
dpr->pr_ctloutput = NULL;
- dpr->pr_fasttimo = NULL;
- dpr->pr_slowtimo = NULL;
dpr->pr_drain = NULL;
dpr->pr_usrreqs = &nousrreqs;
@@ -484,37 +443,3 @@ pf_proto_unregister(int family, int protocol, int type)
return (0);
}
-
-static void
-pfslowtimo(void *arg)
-{
- struct rm_priotracker tracker;
- struct epoch_tracker et;
- struct protosw *pr;
-
- rm_rlock(&pftimo_lock, &tracker);
- NET_EPOCH_ENTER(et);
- LIST_FOREACH(pr, &pfslow_list, pr_slowtimos) {
- (*pr->pr_slowtimo)();
- }
- NET_EPOCH_EXIT(et);
- rm_runlock(&pftimo_lock, &tracker);
- callout_reset(&pfslow_callout, hz / PR_SLOWHZ, pfslowtimo, NULL);
-}
-
-static void
-pffasttimo(void *arg)
-{
- struct rm_priotracker tracker;
- struct epoch_tracker et;
- struct protosw *pr;
-
- rm_rlock(&pftimo_lock, &tracker);
- NET_EPOCH_ENTER(et);
- LIST_FOREACH(pr, &pffast_list, pr_fasttimos) {
- (*pr->pr_fasttimo)();
- }
- NET_EPOCH_EXIT(et);
- rm_runlock(&pftimo_lock, &tracker);
- callout_reset(&pffast_callout, hz / PR_FASTHZ, pffasttimo, NULL);
-}
diff --git a/sys/net/route.h b/sys/net/route.h
index 348ba16d6e88..87cbbbf1d83d 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -95,11 +95,8 @@ struct rt_metrics {
/*
* rmx_rtt and rmx_rttvar are stored as microseconds;
- * RTTTOPRHZ(rtt) converts to a value suitable for use
- * by a protocol slowtimo counter.
*/
#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */
-#define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ))
/* lle state is exported in rmx_state rt_metrics field */
#define rmx_state rmx_weight
diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h
index 33f80a18cafd..6e46f40c8ad7 100644
--- a/sys/sys/protosw.h
+++ b/sys/sys/protosw.h
@@ -52,8 +52,6 @@ struct sockopt;
* Each protocol has a handle initializing one of these structures,
* which is used for protocol-protocol and system-protocol communication.
*
- * Thereafter it is called every 200ms through the pr_fasttimo entry and
- * every 500ms through the pr_slowtimo for timer based actions.
* The system will call the pr_drain entry if it is low on space and
* this should throw away any non-critical data.
*
@@ -67,8 +65,6 @@ struct uio;
/* USE THESE FOR YOUR PROTOTYPES ! */
typedef int pr_ctloutput_t(struct socket *, struct sockopt *);
-typedef void pr_fasttimo_t(void);
-typedef void pr_slowtimo_t(void);
typedef void pr_drain_t(void);
typedef void pr_abort_t(struct socket *);
typedef int pr_accept_t(struct socket *, struct sockaddr **);
@@ -121,19 +117,12 @@ struct protosw {
/* protocol-protocol hooks */
pr_ctloutput_t *pr_ctloutput; /* control output (from above) */
/* utility hooks */
- pr_fasttimo_t *pr_fasttimo; /* fast timeout (200ms) */
- pr_slowtimo_t *pr_slowtimo; /* slow timeout (500ms) */
pr_drain_t *pr_drain; /* flush any excess space possible */
struct pr_usrreqs *pr_usrreqs; /* user-protocol hook */
- LIST_ENTRY(protosw) pr_fasttimos;
- LIST_ENTRY(protosw) pr_slowtimos;
};
/*#endif*/
-#define PR_SLOWHZ 2 /* 2 slow timeouts per second */
-#define PR_FASTHZ 5 /* 5 fast timeouts per second */
-
/*
* This number should be defined again within each protocol family to avoid
* confusion.