Date: Sat, 15 Jul 2000 14:27:03 -0700 From: Alfred Perlstein <bright@wintelcom.net> To: David Greenman <dg@root.com> Cc: net@freebsd.org, dillon@freebsd.org Subject: Re: mbuf refcnt and sendfile Message-ID: <20000715142703.E25571@fw.wintelcom.net> In-Reply-To: <200007151904.MAA20589@implode.root.com>; from dg@root.com on Sat, Jul 15, 2000 at 12:04:39PM -0700 References: <20000715065506.Y25571@fw.wintelcom.net> <200007151904.MAA20589@implode.root.com>
next in thread | previous in thread | raw e-mail | index | archive | help
* David Greenman <dg@root.com> [000715 12:16] wrote: > >http://www.freebsd.org/cgi/query-pr.cgi?pr=19866 > > > >David, I'm pretty sure you didn't like the 'fix' for the mbuf > >cluster refcount presented in this PR (linking all copies using > >a doubly linked list), I have presented an alternative: > > > > Instead of keeping them in a linked list there should be an int/char * > > in the mbuf header that works the same way mclrefcnt does. Instead > > of managing a linked list all one has to do is copy the pointer into > > the new mbuf header and increment it, and decrease it on free, when > > it's zero the deref code is called. > > > >I was wondering what your thoughts on this are? > > I thought it seemed very clever. The linked list method or the pointer refcount method? > >I also had an idea to save on sf_buf's in sendfile: > > > > Forget about them, set the m_ext->ext_buf to point directly at the > > vm_page_t backing the mbuf, you don't need the extra indirection. > > > >I think that could work if you did a vm_page_wire and pmap_qenter > >for each mbuf ref callback and a vm_page_unwire and pmap_qremove > >for each mbuf free callback. > > This one makes my brain hurt (too much to consider). > > There's only one mapping address, so multiple pmap_qenter's would be a > no-op and the first pmap_qremove would remove the mapping, which is not > what you want. You can't use the wire count == 0 to decide when to remove > the mapping either, since it is used all over the system for other > purposes. Basically, you have to have a seperate counter of sendfile > consumers of the page - I don't see any way around that. Ok, I see what's going on, if you have multiple sf_bufs you have the same page mapped in at different offsets (multiple times), you still need the refcount, you could hash on the object/offset and share sf_bufs with multiple sends when you have overlap, but that could pessimize the case when you have a large working set and it's unlikely to have overlap. I was trying to figure out some trick, some sort of existing refcount method for mapping pages in but I haven't found one yet. It could be useful to have a generic refcount scheme for vm pages, perhaps Andrew Gallatin would like it for his zero copy stuff so he can avoid multiple mappings. -Alfred To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000715142703.E25571>