Hello Shahaf, On Wed, Oct 2, 2019 at 6:46 AM Shahaf Shuler <shah...@mellanox.com> wrote: > > Wednesday, October 2, 2019 1:20 AM, Flavio Leitner: > > Subject: [dpdk-dev] [PATCH] vhost: add support to large linear mbufs > > > > The rte_vhost_dequeue_burst supports two ways of dequeuing data. If the > > data fits into a buffer, then all data is copied and a single linear buffer > > is > > returned. Otherwise it allocates additional mbufs and chains them together > > to return a multiple segments mbuf. > > > > While that covers most use cases, it forces applications that need to work > > with larger data sizes to support multiple segments mbufs. > > The non-linear characteristic brings complexity and performance implications > > to the application. > > > > To resolve the issue, change the API so that the application can optionally > > provide a second mempool containing larger mbufs. If that is not provided > > (NULL), the behavior remains as before the change. > > Otherwise, the data size is checked and the corresponding mempool is used > > to return linear mbufs. > > I understand the motivation. > However, providing a static pool w/ large buffers is not so efficient in > terms of memory footprint. You will need to prepare to worst case (all packet > are large) w/ max size of 64KB. > Also, the two mempools are quite restrictive as the memory fill of the mbufs > might be very sparse. E.g. mempool1 mbuf.size = 1.5K , mempool2 mbuf.size = > 64K, packet size 4KB. > > Instead, how about using the mbuf external buffer feature? > The flow will be: > 1. vhost PMD always receive a single mempool (like today) > 2. on dequeue, PMD looks on the virtio packet size. If smaller than the mbuf > size use the mbuf as is (like today) > 3. otherwise, allocate a new buffer (inside the PMD) and link it to the mbuf > as external buffer (rte_pktmbuf_attach_extbuf)
I am missing some piece here. Which pool would the PMD take those external buffers from? If it is from an additional mempool passed to the vhost pmd, I can't see the difference with Flavio proposal. > The pros of this approach is that you have full flexibility on the memory > allocation, and therefore a lower footprint. > The cons is the OVS will need to know how to handle mbuf w/ external buffers > (not too complex IMO). -- David Marchand