afexists()

Doug Barton dougb at FreeBSD.org
Wed Jun 1 00:32:55 UTC 2011


On 05/31/2011 17:19, Bjoern A. Zeeb wrote:
> On May 31, 2011, at 9:14 PM, Doug Barton wrote:
>
> Hey,
>
>> I don't have any specific objections to this change, although adding more calls to afexists() highlights an issue I addressed previously in looking at network.subr. On my system (with IPv6) it's called over 25 times at each boot, which given that it's a moderately expensive test indicates an opportunity for optimization.
>
> Yeah, it's still a lot cheaper than going into the various configurations running ifconfigs etc.  Especially it does not yield errors this way;)

Oh, I agree completely. I'm not saying, "we shouldn't do this," only 
that we should do it smarter.

>> Attached is a patch which caches a positive result for support for a given address family. I don't think caching negative results is a good idea since that could change as the boot progresses.
>
> Not yet for inet or inet6 (or ipx I think) but atm might be loadable.  Looking ahead that's certainly true though maybe also considering virtualization maybe.

I think it's generally safer not to cache the negative answer, and from 
what you're saying it sounds like it may add some future-proofing as 
well. And yes, I did also have VMs in mind, since I'm doing a lot of 
work in that area atm.

>> I plan to commit this on Friday if there are no objections.
>
> I am not sure it helps but I see no regression, so if you want, feel free to go ahead.

If you can assume that each call to the sysctl takes 100 ms (which is a 
WAG for sake of argument), then saving 25 of them will result in us 
booting 2.5 seconds faster. I'd ultimately like to cut the rc.d-related 
portion of the boot in half, if not more, so every little bit helps.


Thanks for the review,

Doug

-- 

	Nothin' ever doesn't change, but nothin' changes much.
			-- OK Go

	Breadth of IT experience, and depth of knowledge in the DNS.
	Yours for the right price.  :)  http://SupersetSolutions.com/



More information about the freebsd-rc mailing list