mbuf and uio

John Baldwin jhb at freebsd.org
Fri Feb 7 16:32:32 UTC 2014


On Friday, February 07, 2014 11:08:33 am Alfred Perlstein wrote:
> On 2/7/14 4:51 AM, Luca Ferrari wrote:
> > Hi all,
> > I'm just wondering why mbufs seems to be much more important from an
> > administrator point of view than uio. I mean, both structures are used
> > to move data thru a stack (network or i/o), but the mbufs get
> > accounted by serveral tools (like netstat and so on) while uio does
> > not.
> > Am I totally wrong on this?
> uios are transient structures that can be allocated on the stack at any 
> time.  In general you'll have at most 1 uio per process/thread active.
> 
> tracking them would not really gain us much.

The other thing is that uios do not allocate their own storage for
I/O buffers.  They merely serve as metadata so that data can be copied between 
userland buffers and other buffers in the kernel (such as the VM pages that 
back a file).   The actual data used for I/O does not belong to the uio.  
mbufs, on the other hand, store packet data.

-- 
John Baldwin


More information about the freebsd-arch mailing list