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
This commit is contained in:
Gleb Smirnoff 2022-08-17 11:50:31 -07:00
parent a0d7d2476f
commit 1922eb3e9c
4 changed files with 0 additions and 91 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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

View File

@ -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.