a proposed callout API

Poul-Henning Kamp phk at phk.freebsd.dk
Mon Nov 13 21:44:27 UTC 2006


In message <20061113133236.A28926 at xorpc.icir.org>, Luigi Rizzo writes:
>On Mon, Nov 13, 2006 at 08:53:41PM +0000, Poul-Henning Kamp wrote:
>> 

>i am a bit curious on why  you want to split the callouts among
>multiple data structures.

A binary heap is optimal for the timeouts that will happen, but
filling it up with timeouts that are unlikely to, and in most
cases won't happen for a very long time will soak up CPU
time used for pointlessly ordering the heap.

Also, many of the "non-happening" timeouts are repeatedly
rescheduled, the TCP keepalives for instance, having a data structure
where this is free of cost is a big advantage.

The other thing is that covering the entire range from hour long
callouts to nanosecond callouts would require a 64 bit value or
a tricky pseudo-FP encoding.  By splitting them in two classes,
I can use two different 31 bit encodings separated by the top bit.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-arch mailing list