Date: Sat, 02 Feb 2008 20:47:55 +0000 From: Poul-Henning Kamp <phk@phk.freebsd.dk> To: arch@freebsd.org Subject: adding general purpose mtx+cv to kthread Message-ID: <12080.1201985275@critter.freebsd.dk>
next in thread | raw e-mail | index | archive | help
The select(2) system call has a dirty little secret data structure (struct seltd) which it hangs off the kthread (->td_sel), amongst the reasons for this is to avoid a mtx_init() and cv_init() and associated destroy calls with each call to select(2). I'm working on an enhancement to sendfile(2) that has the exact same need for a mtx+cv combo and the question is how many other such we have, once we get through the code. Various solutions present themselves, from swallowing the overhead for sendfile(2) since it's probably delta anyway over sharing selects data structure (safe for the locks, since both syscalls are stateless) to what seems most sensible to me: Add a general purpose mtx+cv to struct kthread for use by syscalls that need to keep track of things and sleep on stuff. This wouldn't make the seltd structure go away, it contains other stuff as well, it would just eliminate the mtx+cv combo from it. Any comment or insights ? -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?12080.1201985275>