Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jun 2012 17:53:31 +0200
From:      Davide Italiano <davide.italiano@gmail.com>
To:        soc-status@FreeBSD.org
Subject:   Re-enginer the wheel: a rejuvenation of BSD callout(9) and timer facilities - report weeks 1-4
Message-ID:  <CACYV=-HwUFKnVSWmDc=r0BEzQDUMxEEHhpDthCJuBuu5sLGD1w@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,
I apologize for the delay in submitting but here's what I've done recently.
A complete commit history may be found here:
http://freshbsd.org/search?q=committer%3Adavide&branch=PROJECT_CALLOUTNG

Week 1:
- Switch the callout(9) backend from ticks to struct bintime in order
achieve better precision
- Rework the callout data-structure in order to survive to these
changes paying attention to avoid breakages (if possible)
- Introducing a separate per-cpu queue in order to process callout
once they're examined in callout_tick
- Convert some tcp_timer related code that rely on tick-based nature
of backend, without this change, world won't build

Week 2:
- Fix some bug that causes random memory corruption on the list and so
unexpected behaviour of the system
- Optimize the callout_tick() code to scan the entire wheel only when
it's needed
- Integrate the switched backend with the eventtimers(4)
infrastructure to exploit better precision
- refactor the cpu_new_callout() function in
sys/kern/kern_clocksource.c to adapt to the aforementioned changes

Week 3:
- Start to experiment an extension of the current KPI adding the
callout_reset_bt_on() in which we specify timeouts in terms of struct
bintime rather than ticks.
- Add (experimentally) a function to the sleepqueue(9) KPI
sleepq_set_timeout_bt() in which the timeout may be specified in terms
of bintime rather than ticks, and which takes advantage of the new
precision capabilities of the callout subsystem.
- Convert usleep() service to the new KPI callout_reset_bt_on()
- Run some benchmarks to see how much we gained: resutls may be found
here http://blogs.freebsdish.org/davide/2012/06/07/the-tale-of-usleep-a-k-a-sometimes-precision-matters/

Week 4:

-Fix (or at least, workaround) an include conflict in libprocstat
which causes buildworld to fail, after my recent changes to
sys/sys/_callout.h header.
- Extend the condvar(9) KPI introducing a new cv_timedwait_bt_sig()
function so that we can specify timeout precision in terms of struct
bintime.
-  Refactor the kern_select() and the sys_poll() code so that these
two services may rely on cv_timedwait_bt_sig() rather than on the
previous less precise cv_timedwait_sig().
- Optimize callout_tick() code avoiding some computation of the
callwheel bucket when it's not needed
- Run benchmark on usleep() again, as well as on select(). Results are
so much better than before: :
http://blogs.freebsdish.org/davide/2012/06/17/random-updates/


Davide



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACYV=-HwUFKnVSWmDc=r0BEzQDUMxEEHhpDthCJuBuu5sLGD1w>