amd64 cpu_switch in C.

Peter Jeremy peterjeremy at optushome.com.au
Tue Mar 11 09:56:10 UTC 2008


On Mon, Mar 10, 2008 at 04:26:17PM -1000, Jeff Roberson wrote:
>In fact, the c version is ~10% faster than the assembly version at a two 
>thread sched_yield() test on a single cpu opteron:

That sounds wonderful.  How about comparing it on an SMP system.  Are
there any locking issues that might change that performance difference
with lots of CPUs?

>The only appreciable downside is that it lowers the barrier of entry for 
>modifying a very sensitive piece of code.

IMHO, this isn't a valid reason.  Increasing the both the legibility
and performance of a very sensitive piece of code is a good thing.
Having more people understand the code is also a good thing.  FreeBSD
already implements a substantial barrier of entry to code modification
(commit bits) and I don't believe this should be further raised by
unnecessarily hiding critical code in a language that the majority of
committers are not expert in.  I've seen relatively few examples of
drive-by commits breaking critical code in the past and doubt that
converting cpu_switch()/cpu_throw() into C will suddenly make them the
target of a "how can I break FreeBSD in an obscure manner" competition.
In any case, there is nothing stopping anyone with a src commit bit
mangling the existing assembler implementation.

-- 
Peter Jeremy
Please excuse any delays as the result of my ISP's inability to implement
an MTA that is either RFC2821-compliant or matches their claimed behaviour.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20080311/b95a8701/attachment.pgp


More information about the freebsd-arch mailing list