summaryrefslogtreecommitdiffstats
path: root/sys/net/route.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2006-11-23 05:57:15 +0000
committerbde <bde@FreeBSD.org>2006-11-23 05:57:15 +0000
commit5dd3e715ab7f9ca753d745367c25a8d250782fe0 (patch)
treec2d182cda59cc8b3c9845adb10ae7fd4d06c81e4 /sys/net/route.c
parent7fcbbadd4601e948730a766934e28b508cfa85ba (diff)
downloadFreeBSD-src-5dd3e715ab7f9ca753d745367c25a8d250782fe0.zip
FreeBSD-src-5dd3e715ab7f9ca753d745367c25a8d250782fe0.tar.gz
Initialize a local variable in 2 places just before it is used, not always
at the start of rtalloc1(). This backs out part of revs 1.83 and 1.85. Profiling on an i386 showed that that for sending tiny packets using bge, -current takes 7 bzero()s where RELENG_4 takes only 1, and that bzero()ing is now the dominant overhead (10-12%, up from 1%, but profiling overestimated this a bit). This commit backs out 2 of the 6 extra bzero()s (1 in each of 2 calls per packet to rtalloc1()). They were the largest ones by byte count (48 bytes each) but perhaps not by time (small misaligned ones might take longer).
Diffstat (limited to 'sys/net/route.c')
-rw-r--r--sys/net/route.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index adb28a0..793a1bc 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -137,7 +137,6 @@ rtalloc1(struct sockaddr *dst, int report, u_long ignflags)
int err = 0, msgtype = RTM_MISS;
newrt = NULL;
- bzero(&info, sizeof(info));
/*
* Look up the address in the table for that Address Family
*/
@@ -183,6 +182,7 @@ rtalloc1(struct sockaddr *dst, int report, u_long ignflags)
goto miss;
}
/* Inform listeners of the new route. */
+ bzero(&info, sizeof(info));
info.rti_info[RTAX_DST] = rt_key(newrt);
info.rti_info[RTAX_NETMASK] = rt_mask(newrt);
info.rti_info[RTAX_GATEWAY] = newrt->rt_gateway;
@@ -213,6 +213,7 @@ rtalloc1(struct sockaddr *dst, int report, u_long ignflags)
* Authorities.
* For a delete, this is not an error. (report == 0)
*/
+ bzero(&info, sizeof(info));
info.rti_info[RTAX_DST] = dst;
rt_missmsg(msgtype, &info, 0, err);
}
OpenPOWER on IntegriCloud