[dpdk-dev] DPDK hugepage memory fragmentation

Burakov, Anatoly anatoly.burakov at intel.com
Wed Sep 16 13:19:19 CEST 2020


On 16-Sep-20 5:32 AM, Kamaraj P wrote:
> Hi Anatoly,
> 
> We just dump the memory contents when it fails to allocate the memory.
> 

Hi Kamaraj,

Yes, i can see that the memory is fragmented. That's not what i was 
asking though, because memory fragmentation is *expected* if you're 
using igb_uio. You're not using VFIO and IOVA as VA addressing, so 
you're at the mercy of your kernel when it comes to getting 
IOVA-contiguous address. We in DPDK cannot do anything about it, because 
we don't control which pages we get and what addresses they get 
assigned. There's nothing to fix on our side in this situation.

Here are the things you can do to avoid allocation failure in your case:

1) Drop the IOVA-contiguous allocation flag [1]
2) Use legacy mode [2] [3]
3) Switch to using VFIO [4]
4) Use bigger page size

The first point is crucial! Your allocation *wouldn't have failed* if 
your code didn't specify for the allocation to require 
IOVA-contiguousness. The fact that it has failed means that your 
allocation has requested such memory, so it's on you to ensure that 
whatever you're allocating, IOVA-contiguousness is *required*. I cannot 
decide that for you as it is your code, so it is up to you to figure out 
if whatever you're allocating actually requires such memory, or if you 
can safely remove this allocation flag from your code.

[1] 
http://doc.dpdk.org/api/rte__memzone_8h.html#a3ccbea77ccab608c6e683817a3eb170f
[2] 
http://doc.dpdk.org/guides/prog_guide/env_abstraction_layer.html#memory-mapping-discovery-and-memory-reservation
[3] http://doc.dpdk.org/guides/linux_gsg/linux_eal_parameters.html#id3
[4] I understand the requirement for PF driver, but i think support for 
PF in VFIO is coming in 20.11 release

-- 
Thanks,
Anatoly


More information about the dev mailing list