No free hugepages reported in hugepages when running DPDK helloworld example

Gyp Sud picture Gyp Sud · Dec 23, 2017 · Viewed 10.8k times · Source

I downloaded and built dpdk-stable-16.11.4 version (using the x86_64-native-linuxapp-gcc target). I'm running Ubuntu 16.04.3 LTS. After setting up hugepages according to http://dpdk.org/doc/quick-start or http://dpdk.org/doc/guides-16.04/linux_gsg/sys_reqs.html

mkdir -p /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
echo 64 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages

I can see the hugepages fine.

cat /proc/meminfo | grep Huge

    HugeAnonHugePages:    284672 kB
    ShmemHugePages:        0 kB
    HugePages_Total:      64
    HugePages_Free:       64
    HugePages_Rsvd:        0
    HugePages_Surp:        0
    Hugepagesize:       2048 kB

But when I run the helloWorld example, it complained about no free hugepages, see below.

./build/helloworld -l 0-3 -n 2
EAL: Detected 4 lcore(s)
EAL: No free hugepages reported in hugepages-1048576kB
EAL: Probing VFIO support...
hello from core 1
hello from core 2
hello from core 3
hello from core 0

Also, the memory info showed free hugepages were all gone.

cat /proc/meminfo | grep Huge

    AnonHugePages:    380928 kB
    ShmemHugePages:        0 kB
    HugePages_Total:      64
    HugePages_Free:        0
    HugePages_Rsvd:        0
    HugePages_Surp:        0
    Hugepagesize:       2048 kB

Any idea why this is happening?

Answer

Andriy Berestovskyy picture Andriy Berestovskyy · Dec 24, 2017

1. 1GB Hugepages

The example complains about 1048576kB hugepages, i.e. 1GB. This is correct, you don't have 1GB pages configured as we can see in /proc/meminfo

But you do not need 1GB pages to start a DPDK application, so it just informs and continues.

2. Free Hugepages

The free hugepages are all gone because if we do not specify the amount of memory to use for the DPDK application with -mor --socket-mem option, it will reserve all the available hugepages.

More on that in DPDK Getting Started Guide here.

In case the hugepages remain allocated even when the application has ended (or crashed), you can free the hugepages manually by removing files in /mnt/huge