Hi Maxime, 

Thanks for your comments. 

SNIPPED

if (allocerr_warned) {
> 
>     VHOST_LOG_DATA(ERR,
> 
>     "Failed to allocate memory for mbuf. Packet dropped!\n");
> 
>     allocerr_warned = true;
> 
> }
> 
>  
> 
> This is good idea, but having a static variable makes it file scope 
> making it to  entire VHOST devices. Hence if the intention is to 
> implement device specific
> 
> log rate limit, should not we resort to `dev->allocerr_warn` counter 
> mechanism, which resets after n failures `#define LOG_ALLOCFAIL 32`.

I prefer Flavio's proposal, it would have less performance impact than 
increasing struct virtio_net size. As soon as we can see the error popping once 
in the log message, it gives some clues on what to investigate. Maybe providing 
more details on the failure could help, like printing the pool name and the 
requested length.

Agreed. Change in the next patch, sample format as `VHOST_DATA : Failed mbuf 
alloc of size 2054 from mbuf_pool_socket_0 on /tmp/vhost1.`

SNIPPED

Reply via email to