Improving the kernel/i386 timecounter performance (GSoC proposal)

Maxim Sobolev sobomax at FreeBSD.org
Mon Mar 30 18:45:38 PDT 2009


Robert Watson wrote:
> Part of the point of mapping in the page at execve()-time, or 
> fork()-time for per-process pages (which I'm not entirely convinced we 
> need yet) is to avoid the cost of an extra device open, mmap, etc, for 
> every execve(), which can be quite expensive.  I stuck a prototype page 

You don't really need to do it on every execve() unconditionally. It 
could be done on demand in libc, so that only when thread pass certain 
threshold, the "common page optimization code" kicks in and does its 
open/mmap/etc magic. Otherwise, "normal" syscall is performed. The 
implementation could be as simple as counter in the appropriate libc 
routine, so that optimization engages after certain number of calls. For 
syscalls that return time it's also easy to do frequency thresholds, so 
that for example gettimeofday() only gets optimized if threads calls it 
more frequently that 1 call/sec.

-Maxim


More information about the freebsd-hackers mailing list