John DeNisco | 06dcd45 | 2018-07-26 12:45:10 -0400 | [diff] [blame] | 1 | .. _hugepages: |
| 2 | |
| 3 | Huge Pages |
| 4 | ---------- |
| 5 | |
John DeNisco | ce96dda | 2018-08-14 16:04:09 -0400 | [diff] [blame] | 6 | VPP requires *hugepages* to run during VPP operation, to manage large pages of memory. |
Yulong Pei | 2a7b546 | 2018-11-23 17:37:52 +0800 | [diff] [blame^] | 7 | During VPP installation, VPP will overwrite the existing hugepage settings. |
| 8 | By default, VPP sets the number of hugepages on a system to 1024 2M hugepages. |
| 9 | This is the number of hugepages on the system, not just used by VPP. |
John DeNisco | c64ba6d | 2018-08-02 15:03:15 -0400 | [diff] [blame] | 10 | |
John DeNisco | ce96dda | 2018-08-14 16:04:09 -0400 | [diff] [blame] | 11 | When VPP is installed, the following configuration file is copied to the system. The |
| 12 | hugepage settings are applied in the VPP installation and on system reboots. To set |
| 13 | the hugepage settings, perform the following commands: |
John DeNisco | 06dcd45 | 2018-07-26 12:45:10 -0400 | [diff] [blame] | 14 | |
| 15 | .. code-block:: console |
| 16 | |
| 17 | $ cat /etc/sysctl.d/80-vpp.conf |
| 18 | # Number of 2MB hugepages desired |
| 19 | vm.nr_hugepages=1024 |
| 20 | |
| 21 | # Must be greater than or equal to (2 * vm.nr_hugepages). |
| 22 | vm.max_map_count=3096 |
| 23 | |
| 24 | # All groups allowed to access hugepages |
| 25 | vm.hugetlb_shm_group=0 |
| 26 | |
| 27 | # Shared Memory Max must be greator or equal to the total size of hugepages. |
| 28 | # For 2MB pages, TotalHugepageSize = vm.nr_hugepages * 2 * 1024 * 1024 |
| 29 | # If the existing kernel.shmmax setting (cat /sys/proc/kernel/shmmax) |
| 30 | # is greater than the calculated TotalHugepageSize then set this parameter |
| 31 | # to current shmmax value. |
| 32 | kernel.shmmax=2147483648 |
| 33 | |
John DeNisco | ce96dda | 2018-08-14 16:04:09 -0400 | [diff] [blame] | 34 | Depending on how the system is being used, this configuration file can be updated to adjust |
John DeNisco | 06dcd45 | 2018-07-26 12:45:10 -0400 | [diff] [blame] | 35 | the number of hugepages reserved on a system. Below are some examples of |
John DeNisco | ce96dda | 2018-08-14 16:04:09 -0400 | [diff] [blame] | 36 | possible settings. |
| 37 | |
John DeNisco | 06dcd45 | 2018-07-26 12:45:10 -0400 | [diff] [blame] | 38 | For a small VM with minimal workload: |
| 39 | |
| 40 | .. code-block:: console |
| 41 | |
| 42 | vm.nr_hugepages=512 |
| 43 | vm.max_map_count=2048 |
| 44 | kernel.shmmax=1073741824 |
| 45 | |
| 46 | For a large system running multiple VMs, each needing its own set of hugepages: |
| 47 | |
| 48 | .. code-block:: console |
| 49 | |
| 50 | vm.nr_hugepages=32768 |
| 51 | vm.max_map_count=66560 |
| 52 | kernel.shmmax=68719476736 |
| 53 | |
| 54 | |
| 55 | .. note:: |
| 56 | |
| 57 | If VPP is being run in a Virtual Machine (VM), the VM must have hugepage |
John DeNisco | ce96dda | 2018-08-14 16:04:09 -0400 | [diff] [blame] | 58 | backing. When VPP is installed, it will attempt to overwrite existing the |
| 59 | hugepage setting. If the VM does not have hugepage backing, the install will fail, |
| 60 | but the failure may go unnoticed. When the VM is rebooted, on system startup, |
| 61 | *'vm.nr_hugepages'* will be reapplied, and will fail, and the VM will abort kernel |
John DeNisco | 06dcd45 | 2018-07-26 12:45:10 -0400 | [diff] [blame] | 62 | boot, locking up the VM. To avoid this scenario, ensure the VM has enough |
| 63 | hugepage backing. |