aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJeffrey Hsu <hsu@FreeBSD.org>2003-02-15 02:37:57 +0000
committerJeffrey Hsu <hsu@FreeBSD.org>2003-02-15 02:37:57 +0000
commit4b40c56c28f672ba1cde3a8764655ced1edd0333 (patch)
tree26fbf367f08970d5dc04f53922342ae379ba2006 /sys
parent292dd8a87fab114f1a8e6861bd847d60b63dc7c6 (diff)
downloadsrc-4b40c56c28f672ba1cde3a8764655ced1edd0333.tar.gz
src-4b40c56c28f672ba1cde3a8764655ced1edd0333.zip
Take advantage of pre-existing lock-free synchronization and type stable memory
to avoid acquiring SMP locks during expensive copyout process.
Notes
Notes: svn path=/head/; revision=110896
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/tcp_subr.c7
-rw-r--r--sys/netinet/tcp_timewait.c7
-rw-r--r--sys/netinet/udp_usrreq.c7
3 files changed, 10 insertions, 11 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index cb9682dc0c8a..d12c8991e64b 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -840,8 +840,8 @@ tcp_notify(inp, error)
* can never complete.
*/
if (tp->t_state == TCPS_ESTABLISHED &&
- (error == EHOSTUNREACH || error == ENETUNREACH ||
- error == EHOSTDOWN)) {
+ (error == EHOSTUNREACH || error == ENETUNREACH ||
+ error == EHOSTDOWN)) {
return inp;
} else if (tp->t_state < TCPS_ESTABLISHED && tp->t_rxtshift > 3 &&
tp->t_softerror) {
@@ -922,7 +922,6 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
error = 0;
for (i = 0; i < n; i++) {
inp = inp_list[i];
- INP_LOCK(inp);
if (inp->inp_gencnt <= gencnt) {
struct xtcpcb xt;
caddr_t inp_ppcb;
@@ -936,9 +935,9 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
bzero((char *) &xt.xt_tp, sizeof xt.xt_tp);
if (inp->inp_socket)
sotoxsocket(inp->inp_socket, &xt.xt_socket);
+ xt.xt_inp.inp_gencnt = inp->inp_gencnt;
error = SYSCTL_OUT(req, &xt, sizeof xt);
}
- INP_UNLOCK(inp);
}
if (!error) {
/*
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index cb9682dc0c8a..d12c8991e64b 100644
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -840,8 +840,8 @@ tcp_notify(inp, error)
* can never complete.
*/
if (tp->t_state == TCPS_ESTABLISHED &&
- (error == EHOSTUNREACH || error == ENETUNREACH ||
- error == EHOSTDOWN)) {
+ (error == EHOSTUNREACH || error == ENETUNREACH ||
+ error == EHOSTDOWN)) {
return inp;
} else if (tp->t_state < TCPS_ESTABLISHED && tp->t_rxtshift > 3 &&
tp->t_softerror) {
@@ -922,7 +922,6 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
error = 0;
for (i = 0; i < n; i++) {
inp = inp_list[i];
- INP_LOCK(inp);
if (inp->inp_gencnt <= gencnt) {
struct xtcpcb xt;
caddr_t inp_ppcb;
@@ -936,9 +935,9 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
bzero((char *) &xt.xt_tp, sizeof xt.xt_tp);
if (inp->inp_socket)
sotoxsocket(inp->inp_socket, &xt.xt_socket);
+ xt.xt_inp.inp_gencnt = inp->inp_gencnt;
error = SYSCTL_OUT(req, &xt, sizeof xt);
}
- INP_UNLOCK(inp);
}
if (!error) {
/*
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 4331770ab001..7d2a9f37a8af 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -531,7 +531,7 @@ udp_ctlinput(cmd, sa, vip)
ip->ip_src, uh->uh_sport, 0, NULL);
if (inp != NULL) {
INP_LOCK(inp);
- if(inp->inp_socket != NULL) {
+ if (inp->inp_socket != NULL) {
(*notify)(inp, inetctlerrmap[cmd]);
}
INP_UNLOCK(inp);
@@ -568,8 +568,10 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
* OK, now we're committed to doing something.
*/
s = splnet();
+ INP_INFO_RLOCK(&udbinfo);
gencnt = udbinfo.ipi_gencnt;
n = udbinfo.ipi_count;
+ INP_INFO_RUNLOCK(&udbinfo);
splx(s);
sysctl_wire_old_buffer(req, 2 * (sizeof xig)
@@ -604,7 +606,6 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
error = 0;
for (i = 0; i < n; i++) {
inp = inp_list[i];
- INP_LOCK(inp);
if (inp->inp_gencnt <= gencnt) {
struct xinpcb xi;
xi.xi_len = sizeof xi;
@@ -612,9 +613,9 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
bcopy(inp, &xi.xi_inp, sizeof *inp);
if (inp->inp_socket)
sotoxsocket(inp->inp_socket, &xi.xi_socket);
+ xi.xi_inp.inp_gencnt = inp->inp_gencnt;
error = SYSCTL_OUT(req, &xi, sizeof xi);
}
- INP_UNLOCK(inp);
}
if (!error) {
/*