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).
This commit is contained in:
Bruce Evans 2006-11-23 05:57:15 +00:00
parent 3d229d50ab
commit 6f5967c087

View File

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