Date: Sat, 02 Feb 2008 21:26:13 -0800 From: Julian Elischer <julian@elischer.org> To: Poul-Henning Kamp <phk@phk.freebsd.dk> Cc: arch@freebsd.org Subject: Re: adding general purpose mtx+cv to kthread Message-ID: <47A55075.2090706@elischer.org> In-Reply-To: <12080.1201985275@critter.freebsd.dk> References: <12080.1201985275@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
Poul-Henning Kamp wrote: > 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 ? [...] void *td_syscal_priv; /* valid for duration of syscall only */ [...] seems a reasonably useful thing
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47A55075.2090706>