大页内存分配:
NUMA系统(现在的linux一般都是)
大页内存的挂载
编译
Loading Modules to Enable Userspace IO for DPDK
网卡绑定
echo 1024 >/sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
echo 1024 >/sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages
[root@localhost dpdk-dst]# lscpu
Architecture: x86_64
CPU op-mode(s):32-bit,64-bit
ByteOrder:LittleEndian
CPU(s):2
On-line CPU(s)list:0,1
Thread(s) per core:1
Core(s) per socket:2
Socket(s):1
NUMA node(s):1
Vendor ID:GenuineIntel
CPU family:6
Model:61
Model name:Intel(R)Core(TM) i5-5200U CPU @2.20GHz
Stepping:4
CPU MHz:2194.916
BogoMIPS:4389.83
Hypervisor vendor:VMware
Virtualization type: full
L1d cache:32K
L1i cache:32K
L2 cache:256K
L3 cache:3072K
NUMA node0 CPU(s):0,1
从上面可以看到,
NUMA node(s):1
总共有一个NUMA node,注意这里的node个人理解就是具有独立内存和CPU总线的最小计算单元(每个node内部有自己的CPU总线和内存),而Core就是socket里独立的一组程序执行的硬件单元,比如寄存器,计算单元等,不单独占有内存。
非NUMA系统
echo 1024 >/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
大页内存的挂载
mkdir /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
export RTE_SDK=/home/yml/dpdk/dpdk-stable-16.07.2 //这个是你生成的编译环境的路径
export RTE_TARGET=x86_64-native-linuxapp-gcc //编译的环境变量
export DESTDIR = /home/yml/dpdk/dpdk-stable-16.07.2/ //你的安装路径,就是编译出来的文件的路径
编译
make install T=$RTE_TARGET
Loading Modules to Enable Userspace IO for DPDK
cd x86_64-native-linuxapp-gcc/
sudo modprobe uio
sudo insmod kmod/igb_uio.ko
- sudo insmod kmod/rte_kni.ko
网卡绑定
./tools/dpdk-devbind.py --status 查询网卡状态
[root@localhost tools]#./dpdk-devbind.py --status
Network devices using DPDK-compatible driver
============================================
0000:02:05.0'82545EM Gigabit Ethernet Controller (Copper)' drv=ig`b_uio unused=e1000
0000:02:06.0'82545EM Gigabit Ethernet Controller (Copper)' drv=igb_uio unused=e1000
Network devices using kernel driver
===================================
0000:02:01.0'82545EM Gigabit Ethernet Controller (Copper)'if=eno16777736 drv=e1000 unused=igb_uio *Active*
0000:02:07.0'82545EM Gigabit Ethernet Controller (Copper)'if=eno67109432 drv=e1000 unused=igb_uio
Other network devices
=====================
<none>
./tools/dpdk-devbind.py --bind=igb_uio 02:07.0