git: 340c7343f4e0 - main - protocols: don't execute protosw_init() for every VNET
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 03 Jan 2022 18:22:54 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=340c7343f4e02fa7d7b36cbefa0d9856d1811eea
commit 340c7343f4e02fa7d7b36cbefa0d9856d1811eea
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-01-03 18:15:21 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-01-03 18:15:21 +0000
protocols: don't execute protosw_init() for every VNET
The function now modifies pr_usrreqs only, which are always
global. Rename it to pr_usrreqs_init().
Differential revision: https://reviews.freebsd.org/D33538
---
sys/kern/uipc_domain.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c
index 200637e00ad8..da21ed29a716 100644
--- a/sys/kern/uipc_domain.c
+++ b/sys/kern/uipc_domain.c
@@ -116,12 +116,12 @@ struct pr_usrreqs nousrreqs = {
};
static void
-protosw_init(struct protosw *pr)
+pr_usrreqs_init(struct protosw *pr)
{
struct pr_usrreqs *pu;
pu = pr->pr_usrreqs;
- KASSERT(pu != NULL, ("protosw_init: %ssw[%d] has no usrreqs!",
+ KASSERT(pu != NULL, ("%s: %ssw[%d] has no usrreqs!", __func__,
pr->pr_domain->dom_name,
(int)(pr - pr->pr_domain->dom_protosw)));
@@ -191,8 +191,6 @@ domain_init(void *arg)
if (dp->dom_init)
(*dp->dom_init)();
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) {
- protosw_init(pr);
-
/*
* Note that with VIMAGE enabled, domain_init() will be
* re-invoked for each new vnet that's created. The below lists
@@ -200,6 +198,7 @@ domain_init(void *arg)
* state for non-default vnets.
*/
if (IS_DEFAULT_VNET(curvnet)) {
+ pr_usrreqs_init(pr);
rm_wlock(&pftimo_lock);
if (pr->pr_fasttimo != NULL)
LIST_INSERT_HEAD(&pffast_list, pr,
@@ -412,6 +411,7 @@ pf_proto_register(int family, struct protosw *npr)
/* Copy the new struct protosw over the spacer. */
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);