Tmpfs elimination of double-copy

Alexander Leidinger Alexander at Leidinger.net
Tue Jun 22 07:13:48 UTC 2010


Quoting Kostik Belousov <kostikbel at gmail.com> (from Mon, 21 Jun 2010  
21:49:28 +0300):

> Tmpfs uses OBJT_SWAP object to keep the data pages for the files.
> Current code allocates another object of type OBJT_VNODE, assigned
> to vp->v_object, to satisfy VM interface for mapping the file, using
> vnode_create_vobject. The objects do not share the pages (I do not think
> this can be easily achieved without serious changes to VM). Thus most,
> if not all, the data is present in two sets of pages.
>
> When such file is written to, tmpfs copies user buffer both to the swap
> object, and to the v_object.
>
> Patch I posted assigns the swap object to the vp->v_object. I had to
> make small change to vm_mmap_vnode() to not allocate the vnode pager
> and to not increment vnode use counter when v_object is the swap
> object.

Did you measure the performance before/after? If not, what are your  
performance expectations? I don't expect we get double the  
performance, but if every data of a write is copied twice, I would  
guess there is a measurable benefit.

Bye,
Alexander.

-- 
At work, the authority of a person is inversely proportional to the
number of pens that person is carrying.

http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID = 72077137


More information about the freebsd-fs mailing list