dpdk设置

本文档详细介绍了在Ubuntu/Debian系统上安装和配置Data Plane Development Kit (DPDK)的步骤,包括编译DPDK软件、确保系统软件满足要求(如内核版本大于4.4,glibc大于2.7)以及设置和使用Hugepages以提高性能。通过预留Hugepages并在启动时配置,可以优化DPDK应用的内存分配,提升系统效率。
摘要由CSDN通过智能技术生成

1、 Introduction

This document contains instructions for installing and configuring the Data Plane Development Kit (DPDK) software. It is designed to get customers up and running quickly. The document describes how to compile and run a DPDK application in a Linux application (linux) environment, without going deeply into detail.

2、Compilation of the DPDK

For Ubuntu/Debian systems these can be installed using apt install build-essential
Python 3.5 or later.
pip3 install meson ninja
For Ubuntu/Debian it can be installed using apt install python3-pyelftools
libnuma-dev in Debian/Ubuntu;

3、Running DPDK Applications

3.1、System Software

3.1.1、Kernel version >= 4.4

The kernel version in use can be checked using the command: uname -r

3.1.2、glibc >= 2.7

The version can be checked using the ldd --version command.

3.2、Use of Hugepages in the Linux Environment

Hugepage support is required for the large memory pool allocation used for packet buffers (the HUGETLBFS option must be enabled in the running kernel as indicated the previous section). By using hugepage allocations, performance is increased since fewer pages are needed, and therefore less Translation Lookaside Buffers (TLBs, high speed translation caches), which reduce the time it takes to translate a virtual page address to a physical page address. Without hugepages, high TLB miss rates would occur with the standard 4k page size, slowing performance.

3.2.1、 Reserving Hugepages for DPDK Use

This is done by echoing the number of hugepages required to a nr_hugepages file in the /sys/kernel/ directory corresponding to a specific page size (in Kilobytes). For a single-node system, the command to use is as follows (assuming that 1024 of 2MB pages are required):

echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
echo 1024 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages

it is preferable to reserve hugepages at boot time
To reserve hugepages at boot time, a parameter is passed to the Linux kernel on the kernel command line.
For example, to reserve 4G of hugepage memory in the form of four 1G pages, the following options should be passed to the kernel:

default_hugepagesz=1G hugepagesz=1G hugepages=4

3.2.2、Using Hugepages with the DPDK

If secondary process support is required, mount points for hugepages need to be created. On modern Linux distributions, a default mount point for hugepages is provided by the system and is located at /dev/hugepages. This mount point will use the default hugepage size(2M) set by the kernel parameters as described above.

However, in order to use hugepage sizes other than the default, it is necessary to manually create mount points for those hugepage sizes (e.g. 1GB pages).

To make the hugepages of size 1GB available for DPDK use, following steps must be performed:

mkdir /mnt/huge
mount -t hugetlbfs pagesize=1GB /mnt/huge

The mount point can be made permanent across reboots, by adding the following line to the /etc/fstab file:

nodev /mnt/huge hugetlbfs pagesize=1GB 0 0

cat /proc/meminfo

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值