Hi Olivier,
On 1/16/2018 7:21 PM, Olivier Matz wrote:
On Fri, Dec 22, 2017 at 09:48:01PM +0530, Hemant Agrawal wrote:
On 12/22/2017 7:29 PM, Olivier MATZ wrote:
On Wed, Dec 20, 2017 at 05:29:59PM +0530, Hemant Agrawal wrote:
On 12/19/2017 6:38 PM, Hemant Agrawal wrote:
That's true, I commented too fast :)
And what about using mp->nb_mem_chunks instead? Would it do the job
in your use-case?
It should work. Let me check it out.
There is a slight problem with nb_mem_chunks.
It is getting incremented in the end of "rte_mempool_populate_phys",
while the elements are getting populated before it in the call of
mempool_add_elem.
I can use nb_mem_chunks are '0' check. However it can break in future if
mempool_populate_phys changes.
Sorry, I'm not sure I'm getting what you say.
My question was about using mp->nb_mem_chunks instead of a new flag in the
dppa driver. Am I missing something?
mp->nb_mem_chunks gets finalized when the mempool is fully created. It's
value is transient before that i.e. it will keep on changing on the every
call to rte_mempool_populate_phys.
However, we need this information on the very first element allocation. So,
nb_mem_chunks will not work.
I see 2 other alternatives:
1/ in your driver, register a callback rte_mempool_ops_register_memory_area()
that sets a private flag if (len < total_elt_sz * mp->size).
Thanks!
This one works. Now, the changes will be confined to dpaa code only. I
will send a v2 for that.
2/ Move
STAILQ_INSERT_TAIL(&mp->mem_list, memhdr, next);
mp->nb_mem_chunks++;
before the calls to mempool_add_elem(), and in your driver check if
SLIST_FIRST(&mp->mem_list)->len < total_elt_sz * mp->size
If we can avoid to again create another flag, it is better.