some question about mbuf reuse

Mike Silbersack silby at silby.com
Sat Jun 4 18:07:28 PDT 2005


On Wed, 1 Jun 2005, jun lu wrote:

>   our project write a web server in freebsd kernel. we can receive and 
> send data directly in kernel.Now i have some idea, i think i can creat a 
> mbuf with cluster buffer before i send some data,because the data i want 
> to send are all in kernel,so i can take thest data in cluster i create 
> before,and transfer this mbuf to sosend(),then i make tcp/ip cann't 
> release this mbuf after it received the ack.In this way, i can send data 
> in kernel next time use the same mbuf with different cluster.i am not 
> sure whether this way can enhance the performance.So,i hope some one can 
> discuss with me

I don't think that what you are proposing would work.  Mbuf clusters can 
be used in multiple mbuf chains at the same time, but I don't see how you 
could do that with mbufs.  You probably should focus your optimization 
efforts elsewhere, because changing the mbuf api would make your code 
diverge too much from the standard FreeBSD kernel to be useful to anyone.

Mike "Silby" Silbersack


More information about the freebsd-net mailing list