[root@localhost dpdk_lcores]# ./build/app/test --lcores "(0,1,2,3,4)@(0,1),(5,6,7,8)@3" EAL: Detected 128 lcore(s) EAL: Detected 4 NUMA nodes EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: No available hugepages reported in hugepages-2048kB EAL: Probing VFIO support... EAL: PCI device 0000:05:00.0 on NUMA socket 0 EAL: probe driver: 19e5:200 net_hinic EAL: PCI device 0000:06:00.0 on NUMA socket 0 EAL: probe driver: 19e5:200 net_hinic EAL: PCI device 0000:7d:00.0 on NUMA socket 0 EAL: probe driver: 19e5:a222 net_hns3 EAL: PCI device 0000:7d:00.1 on NUMA socket 0 EAL: probe driver: 19e5:a221 net_hns3 EAL: PCI device 0000:7d:00.2 on NUMA socket 0 EAL: probe driver: 19e5:a222 net_hns3 EAL: PCI device 0000:7d:00.3 on NUMA socket 0 EAL: probe driver: 19e5:a221 net_hns3 hello from core 1 hello from core 2 hello from core 3 hello from core 4 hello from core 5 hello from core 6 hello from core 7 hello from core 8 hello from core 0
[root@localhost kni]# ps -elf | grep test 0 R root 19190 18466 99 80 0 - 8390171 - 05:26 pts/1 00:01:18 ./build/app/test --lcores (0,1,2,3,4)@(0,1),(5,6,7,8)@3 0 S root 19203 17774 0 80 0 - 1729 pipe_w 05:26 pts/0 00:00:00 grep --color=auto test [root@localhost kni]# ps -mo pid,tid,%cpu,psr,rss,trs,pmem,stat,cmd -p 19190 PID TID %CPU PSR RSS TRS %MEM STAT CMD 19190 - 220 - 10048 6884 0.0 - ./build/app/test --lcores (0,1,2,3,4)@(0,1),(5,6,7,8)@3 - 19190 24.8 0 - - - Rl+ - - 19191 0.0 44 - - - Sl+ - - 19192 0.0 45 - - - Sl+ - - 19193 33.0 1 - - - Rl+ - - 19194 24.8 0 - - - Rl+ - - 19195 33.0 1 - - - Rl+ - - 19196 24.7 0 - - - Rl+ - - 19197 19.8 3 - - - Rl+ - - 19198 19.8 3 - - - Rl+ - - 19199 19.8 3 - - - Rl+ - - 19200 19.8 3 - - - Rl+ - [root@localhost kni]#
[root@localhost kni]# cat /sys/devices/system/node/node*/hugepages/hugepages-2048kB/nr_hugepages 0 0 0 0
[root@localhost kni]# cat /proc/meminfo | grep Huge AnonHugePages: 0 kB ShmemHugePages: 0 kB HugePages_Total: 256 HugePages_Free: 255 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 524288 kB [root@localhost kni]#
[root@localhost kni]# echo 256 > /sys/kernel/mm/hugepages/hugepages-524288kB/nr_hugepages [root@localhost kni]# ls /sys/devices/system/node/node*/hugepages/hugepages-2048kB/nr_hugepages /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages /sys/devices/system/node/node2/hugepages/hugepages-2048kB/nr_hugepages /sys/devices/system/node/node3/hugepages/hugepages-2048kB/nr_hugepages [root@localhost kni]# echo 64 /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages 64 /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages [root@localhost kni]# echo 64 /sys/devices/system/node/node2/hugepages/hugepages-2048kB/nr_hugepages 64 /sys/devices/system/node/node2/hugepages/hugepages-2048kB/nr_hugepages [root@localhost kni]# echo 64 /sys/devices/system/node/node3/hugepages/hugepages-2048kB/nr_hugepages 64 /sys/devices/system/node/node3/hugepages/hugepages-2048kB/nr_hugepages [root@localhost kni]# echo 64 /sys/devices/system/node/node4/hugepages/hugepages-2048kB/nr_hugepages 64 /sys/devices/system/node/node4/hugepages/hugepages-2048kB/nr_hugepages [root@localhost kni]#
还是一样
[root@localhost dpdk_lcores]# ./build/app/test --lcores "(0,1,2,3,4)@(0,1),(5,6,7,8)@3" EAL: Detected 128 lcore(s) EAL: Detected 4 NUMA nodes EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: No available hugepages reported in hugepages-2048kB EAL: Probing VFIO support... EAL: PCI device 0000:05:00.0 on NUMA socket 0 EAL: probe driver: 19e5:200 net_hinic EAL: PCI device 0000:06:00.0 on NUMA socket 0 EAL: probe driver: 19e5:200 net_hinic EAL: PCI device 0000:7d:00.0 on NUMA socket 0 EAL: probe driver: 19e5:a222 net_hns3 EAL: PCI device 0000:7d:00.1 on NUMA socket 0 EAL: probe driver: 19e5:a221 net_hns3 EAL: PCI device 0000:7d:00.2 on NUMA socket 0 EAL: probe driver: 19e5:a222 net_hns3 EAL: PCI device 0000:7d:00.3 on NUMA socket 0 EAL: probe driver: 19e5:a221 net_hns3 hello from core 1 hello from core 2 hello from core 3 hello from core 4 hello from core 5 hello from core 6 hello from core 7 hello from core 8 hello from core 0
[root@localhost kni]# cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages 0 [root@localhost kni]# cat /sys/kernel/mm/hugepages/hugepages-524288kB/nr_hugepages 256 [root@localhost kni]#
[root@localhost kni]# echo 256 >> /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages [root@localhost kni]# cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages 256 [root@localhost kni]# cat /sys/kernel/mm/hugepages/hugepages-524288kB/nr_hugepages 256 [root@localhost kni]#
[root@localhost dpdk_lcores]# ./build/app/test --lcores "(0,1,2,3,4)@(0,1),(5,6,7,8)@3" EAL: Detected 128 lcore(s) EAL: Detected 4 NUMA nodes EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: 256 hugepages of size 2097152 reserved, but no mounted hugetlbfs found for that size EAL: Probing VFIO support... EAL: PCI device 0000:05:00.0 on NUMA socket 0 EAL: probe driver: 19e5:200 net_hinic EAL: PCI device 0000:06:00.0 on NUMA socket 0 EAL: probe driver: 19e5:200 net_hinic EAL: PCI device 0000:7d:00.0 on NUMA socket 0 EAL: probe driver: 19e5:a222 net_hns3 EAL: PCI device 0000:7d:00.1 on NUMA socket 0 EAL: probe driver: 19e5:a221 net_hns3 EAL: PCI device 0000:7d:00.2 on NUMA socket 0 EAL: probe driver: 19e5:a222 net_hns3 EAL: PCI device 0000:7d:00.3 on NUMA socket 0 EAL: probe driver: 19e5:a221 net_hns3 hello from core 1 hello from core 2 hello from core 3 hello from core 4 hello from core 5 hello from core 6 hello from core 7 hello from core 8 hello from core 0
[root@localhost kni]# grep Hugepagesize /proc/meminfo Hugepagesize: 524288 kB [root@localhost kni]#
执行
umount /mnt/huge/
[root@localhost kni]# mount -t hugetlbfs none /mnt/huge/ -o pagesize=2MB
[root@localhost kni]#
[root@localhost kni]# cat /proc/meminfo | grep Huge AnonHugePages: 0 kB ShmemHugePages: 0 kB HugePages_Total: 256 HugePages_Free: 256 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 524288 kB [root@localhost kni]#
[root@localhost dpdk_lcores]# ./build/app/test --lcores "(0,1,2,3,4)@(0,1),(5,6,7,8)@3" EAL: Detected 128 lcore(s) EAL: Detected 4 NUMA nodes EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: Probing VFIO support... EAL: PCI device 0000:05:00.0 on NUMA socket 0 EAL: probe driver: 19e5:200 net_hinic EAL: PCI device 0000:06:00.0 on NUMA socket 0 EAL: probe driver: 19e5:200 net_hinic EAL: PCI device 0000:7d:00.0 on NUMA socket 0 EAL: probe driver: 19e5:a222 net_hns3 EAL: PCI device 0000:7d:00.1 on NUMA socket 0 EAL: probe driver: 19e5:a221 net_hns3 EAL: PCI device 0000:7d:00.2 on NUMA socket 0 EAL: probe driver: 19e5:a222 net_hns3 EAL: PCI device 0000:7d:00.3 on NUMA socket 0 EAL: probe driver: 19e5:a221 net_hns3 hello from core 1 hello from core 2 hello from core 3 hello from core 4 hello from core 5 hello from core 6 hello from core 7 hello from core 8 hello from core 0
将 hugetlbfs 特殊文件系统挂载到根文件系统的某个目录 mount -t hugetlbfs hugetlbfs /dev/hugepages (挂载默认的hugeage大小) mount -t hugetlbfs none /dev/hugepages_2mb -o pagesize=2MB(挂载2M的) 1G大页和2M大页必须挂载了才能使用。挂载其中一个,DPDK也能正常运行。