Ben, per my understanding, buffers are allocated in 
netdev_linux_batch_rxq_recv_sock, they should have been thread-local, do you 
mean maintain static buffers per thread (declared as thread local storage 
array)? I don't think it is feasible, maybe they aren't free on receiving next 
time because those buffers last time aren't handled.

I'll try your recvmmsg emulation patch, I didn't see it, I don't check all the 
patches in ovs-dev, which are really too many :-)

-----邮件原件-----
发件人: Ben Pfaff [mailto:b...@ovn.org] 
发送时间: 2019年12月19日 23:56
收件人: Yi Yang (杨燚)-云服务集团 <yangy...@inspur.com>
抄送: yang_y...@163.com; ovs-dev@openvswitch.org; ian.sto...@intel.com
主题: Re: 答复: [PATCH] Use batch process recv for tap and raw socket in netdev 
datapath

On Wed, Dec 18, 2019 at 02:01:47AM +0000, Yi Yang (杨 D)-云服务集团 wrote:
> Ben, thank for your review, for recvmmsg, we have to prepare some 
> buffers for it, but we have no way to know how many packets are there 
> for socket, so these mallocs are must-have overhead, maybe 
> self-adaptive malloc mechanism is better, for example, the first 
> receive just mallocs 4 buffers, if it receives 4 buffers successfully, 
> we can increase it to 8, till it is up to 32, if it can't receive all 
> the buffers, we can decrease it by one half, but this will make code 
> complicated a bit.

I don't know whether this is actually a performance problem in practice.
My thought is caching: maintain a per-thread collection of buffers and receive 
into those, then return only the ones that actually got populated and keep the 
rest for next time.

> Your fix is right, I should be set to 0 when retval < 0, thank for 
> your review again, I'll update it with your fix patch and send another 
> version.

Would you mind reviewing the patch I posted that adds recvmmsg() emulation for 
systems that don't have it?  I CCed you on it.
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to