On Fri, Oct 15, 2021 at 12:33:31PM +0300, Andrew Rybchenko wrote: > On 10/15/21 12:18 PM, Dmitry Kozlyuk wrote: > >> -----Original Message----- > >> From: Andrew Rybchenko <andrew.rybche...@oktetlabs.ru> > >> [...] > >>> diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c > >>> index 51c0ba2931..2204f140b3 100644 > >>> --- a/lib/mempool/rte_mempool.c > >>> +++ b/lib/mempool/rte_mempool.c > >>> @@ -371,6 +371,8 @@ rte_mempool_populate_iova(struct rte_mempool *mp, > >>> char *vaddr, > >>> > >>> STAILQ_INSERT_TAIL(&mp->mem_list, memhdr, next); > >>> mp->nb_mem_chunks++; > >>> + if (iova == RTE_BAD_IOVA) > >>> + mp->flags |= MEMPOOL_F_NON_IO; > >> > >> As I understand rte_mempool_populate_iova() may be called few times for > >> one mempool. The flag must be set if all invocations are done with > >> RTE_BAD_IOVA. So, it should be set by default and just removed when iova > >> != RTE_BAD_IOVA happens. > > > > I don't agree at all. If any object of the pool is unsuitable for IO, > > the pool cannot be considered suitable for IO. So if there's a single > > invocation with RTE_BAD_IOVA, the flag must be set forever. > > If so, some objects may be used for IO, some cannot be used. > What should happen if an application allocates an object > which is suitable for IO and try to use it this way?
If the application can predict if the allocated object is usable for IO before allocating it, I would be surprised to have it used for IO. I agree with Dmitry here.