Adrian, On Wed, Jul 10, 2013 at 04:36:23PM -0700, Adrian Chadd wrote: A> I've started writing an aio_sendfile() syscall. A> A> http://people.freebsd.org/~adrian/ath/20130710-aio-sendfile-3.diff A> A> Yes, the diff is against -HEAD and not stable/9. A> A> It's totally horrible, hackish and likely bad. I've only done some A> very, very basic testing to ensure it actually works; i haven't at all A> stress tested it out yet. It's also very naive - I'm not at all doing A> any checks to see whether I can short-cut to do the aio there and A> then; I'm always queuing the sendfile() op through the worker threads. A> That's likely stupid and inefficient in a lot of cases, but it at A> least gets the syscall up and working. A> A> I'd like some feedback and possibly some help in stress testing it to A> make sure it's functioning well. Apart from problem pointed out by Kostik, there is a race between aio thread starting with aio_process_sendfile() and file descriptor (or socket descriptor) going away. Thus, kern_sendfile() needs to be split into two parts: kern_sendfile_pre() and kern_sendfile() that should contain only the sending cycle. The kern_sendfile_pre() should contain: fgetvp_read(uap->fd, &vp) vm_object_reference_locked(vp->v_object) Referencing the socket is probably also required. Current synchronous code doesn't do it. The do_sendfile() function should call kern_sendfile_pre() and then kern_sendfile(). The aio code should perform kern_sendfile_pre() in the new syscall itself in context of calling process, and kern_sendfile() in async context. P.S. Some time ago I have started hacking on the above. -- Totus tuus, Glebius.Received on Thu Jul 11 2013 - 08:17:29 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:39 UTC