Improving the kernel/i386 timecounter performance (GSoC proposal)

Peter Jeremy peterjeremy at optushome.com.au
Sun Mar 29 11:07:50 PDT 2009


On 2009-Mar-27 14:19:16 -0400, Alexander Sack <pisymbol at gmail.com> wrote:
>On Fri, Mar 27, 2009 at 1:31 PM, Poul-Henning Kamp <phk at phk.freebsd.dk> wrote:
>> In message <49CD0405.1060704 at samsco.org>, Scott Long writes:
>>
>>>I've been talking about this for years.  All I need is help with the VM
>>>magic to create the page on fork.  I also want two pages, one global
>>>for gettimeofday (and any other global data we can think of) and one
>>>per-process for static data like getpid/getgid.

gettimeofday is likely to be a mixture of global and per-core data so
possibly a 3rd page containing per-core data is warranted.

>I'm assuming folks are still in love with the TSC because it still the
>cheapest as oppose ACPI-fast or HPET to even contemplate this?

That is its major advantage.  It might be feasible to export all the
data necessary to implement the complete CLOCK_*_FAST family.

>Also I thought at least PHK's comment (Sergey mentioned it) was true
>regardless of bus, that the TSC is not consistent across multiple
>packages (and for that matter I suppose cores) due to I *think* its
>ISA lineage so how does this work again?

TSC is nothing to do with ISA.  The easiest way to build a counter
that runs at CPU clock rate is to put it very close to the CPU/core
and have different counters for each CPU/core, without any
synchronisation between the different counters.

>  Won't the rate in which you
>tick up be sporadic over the course of the process scheduled on
>different cores?  (i.e. depending on what core RDTSC happened to land
>on)

RDTSC will wind up on the same core that your thread of execution is
running on and this is defined by the scheduler.  IE, it's up to the
scheduler to ensure that the correct page of global (or per-cpu) data
is mapped.

-- 
Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20090329/4f7b7176/attachment.pgp


More information about the freebsd-current mailing list