On 14-Feb-18 8:04 AM, Thomas Monjalon wrote:
19/12/2017 12:14, Anatoly Burakov:
* Memory tagging. This is related to previous item. Right now, we can only ask
malloc to allocate memory by page size, but one could potentially have
different memory regions backed by pages of similar sizes (for example,
locked 1G pages, to completely avoid TLB misses, alongside regular 1G
and it would be good to have that kind of mechanism to distinguish between
different memory types available to a DPDK application. One could, for
tag memory by "purpose" (i.e. "fast", "slow"), or in other ways.
How do you imagine memory tagging?
Should it be a parameter when requesting some memory from rte_malloc
We can't make it a parameter for mempool without making it a parameter
for rte_malloc, as every memory allocation in DPDK works through
rte_malloc. So at the very least, rte_malloc will have it. And as long
as rte_malloc has it, there's no reason why memzones and mempools
couldn't - not much code to add.
Could it be a bit-field allowing to combine some properties?
Does it make sense to have "DMA" as one of the purpose?
Something like a bitfield would be my preference, yes. That way we could
classify memory in certain ways and allocate based on that. Which
"certain ways" these are, i'm not sure. For example, in addition to
tagging memory as "DMA-capable" (which i think is a given), one might
tag certain memory as "non-default", as in, never allocate from this
chunk of memory unless explicitly asked to do so - this could be useful
for types of memory that are a precious resource.
Then again, it is likely that we won't have many types of memory in
DPDK, and any other type would be implementation-specific, so maybe just
stringly-typing it is OK (maybe we can finally make use of "type"
parameter in rte_malloc!).
How to transparently allocate the best memory for the NIC?
You take care of the NUMA socket property, but there can be more
requirements, like getting memory from the NIC itself.
I would think that we can't make it generic enough to cover all cases,
so it's best to expose some API's and let PMD's handle this themselves.
+Cc more people (6WIND, Cavium, Chelsio, Mellanox, Netronome, NXP, Solarflare)
in order to trigger a discussion about the ideal requirements.