Porting tmpfs
Matthew Dillon
dillon at apollo.backplane.com
Sat Mar 28 12:52:05 PDT 2009
:Now uobj is allocated by swap_pager. Is it possible to use swap_pager object in
:the capacity of vnode's object to get swapping working or it may interfere with
:buffer cache?
The vnode's VM object has to use the vnode pager, it cannot be backed
by swap. Theoretically one can stack a swap object behind the vnode
but it probably would not work... the VM code was never designed to
support swap-backed vnode objects.
Hmm. If the uobj is backed by swap it should be possible to move
(rename) VM pages from the uobj to the vnode object in the VOP_READ op,
prior to instantiating the buffer cache buffer. A dirty VM page
would remain dirty and cause the related buffer cache buffer to be
automatically marked dirty as well. Once the VM pages are moved a
getblk()/bread() etc will automatically incorporate them into the
buffer cache buffer. Some care would have to be taken not to instantiate
the buffer cache buffer until all related VM pages have been moved (so
there is no duplication), but it should work.
Getting the VM pages from the vnode object back to the uobj might
be a bit more difficult. You can probably hook-in at the VOP_STRATEGY
function but the only way to rip-out the buffer cache buffer's
VM page backing store safely would be ONLY if the buffer cache buffer
is marked B_RELBUF at the time the strategy function is called. I
think it is doable. You would have to check whether the page exists
in the uobj and destroy it if it does before you can rename the
VM page in the buffer cache back to the uobj.
You seem to be making really good progress, I recommend getting tmpfs
100% working before tackling the buffer cache efficiency issues.
Also, if you need a leaf.dragonflybsd.org shell account to work with
(e.g. to run vkernels to test with), just send me a private email with
your desired username and ssh public key and I will set it up.
--
Dion also expressed an interest in doing a tmpfs port. It kinda looks
like Nikita got ahead of the game there, sorry Dion! It happens
sometimes :-)
-Matt
Matthew Dillon
<dillon at backplane.com>
More information about the Kernel
mailing list