[RFC] kern/kern_timeout.c rewrite in progress
Hans Petter Selasky
hps at selasky.org
Sun Jan 4 12:14:29 UTC 2015
Hi,
Please find attached an updated timeout patch which also updates clients
in the kernel area to use the callout API properly, like cv_timedwait().
Previously there was some custom sleepqueue code in the callout
subsystem. All of that has now been removed and we allow callouts to be
protected by spinlocks. This allows us to tear down the callback like
done with regular mutexes, and a "td_slpmutex" has been added to "struct
thread" to atomically teardown the "td_slpcallout". Further the
"TDF_TIMOFAIL" and "SWT_SLEEPQTIMO" states can now be completely removed.
Summary of changes:
1) Make consistent callout API which also supports spinlocks for the
callback function. This has been done to allow atomic callout stop of
"td_slpcallout" without the need of many kernel threading quirks.
2) It is not allowed to migrate CPU if the timeout is restarted while
the timeout callback is executing. Callouts must be stopped before CPU
migration is allowed. Optionally drained.
3) Shared lock support has been removed, because it prevents atomic stop
of the callback function.
4) A new API to drain callouts asynchronously has been added, called
"callout_drain_async()".
Please test and report any errors!
Patch applies to FreeBSD-11-current as of today.
Thank you!
--HPS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kern_timeout_wip_v2.diff
Type: text/x-patch
Size: 54295 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20150104/b6404553/attachment.bin>
More information about the freebsd-current
mailing list