new lwbuf api and mpsafe sf_bufs
sjg at evilcode.net
Sat Mar 7 19:20:35 PST 2009
The basic thought behind the new lwbuf api is that sf_buf's have been
abused more and more as time has passed for purposes that don't
necessarily match the original intent. Most uses of sf_bufs beyond
sendfile are exceedingly short-lived, short enough that they would be
better served by cpu-local caches of kvm space, even if that means a
bit of overlap now and again. lwbuf attempts to match the semantics of
xio, with one addition as suggested by Simon, a sanity check and tlb
invalidation in lwbuf_kva if the lwbuf strays to some other cpu.
Currently lwbuf allocates a page of kvm at a time on objcache object
construction and stores the kvm with the object in objcache when it is
returned to the cache.
sf_bufs, which are still most applicable to sendfile, have been
simplified on top of the lwbuf api, converted to objcache and the
global hash has been protected with a spinlock.
XIO and exec have been modified to use lwbuf's.
More information about the Submit