Skip to content

Commit

Permalink
vpp: use Ansible variables to configure hugepages in the sysctl
Browse files Browse the repository at this point in the history
Ansible hugepages_2M or hugepages_1G variable will be used to populate
80-vpp.conf file in the sysctl.d instead of previous values read from
sysctl. This fixes a problem with VPP using old hugepages number, even
after updating kernel flags.

Signed-off-by: Przemyslaw Lal <[email protected]>
  • Loading branch information
przemeklal committed Apr 9, 2020
1 parent 53fbecd commit f1cb913
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions roles/userspace-cni-install/tasks/vpp-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@
register: vpp_sh_rh

- name: capture sysctl configuration
command: sysctl -n kernel.shmmax vm.nr_hugepages vm.max_map_count
command: sysctl -n kernel.shmmax vm.max_map_count
register: original_sysctl

- name: calc intermediate VPP sysctl entries values
set_fact:
vpp_orig_shmmax: "{{ original_sysctl.stdout_lines[0] }}"
vpp_orig_max_map_count: "{{ original_sysctl.stdout_lines[2] }}"
vpp_orig_max_map_count: "{{ original_sysctl.stdout_lines[1] }}"
vpp_calc_shmmax: "{{ (default_hugepage_size == '2M') | ternary(hugepages_2M*2048*1024, hugepages_1G*1024*1024*1024) }}"
vpp_calc_max_map_count: "{{ (default_hugepage_size == '2M') | ternary(hugepages_2M*3, hugepages_1G*3) }}"

- name: pick final sysctl entries values
set_fact:
vpp_nr_hugepages: "{{ original_sysctl.stdout_lines[1] }}"
vpp_nr_hugepages: "{{ (default_hugepage_size == '2M') | ternary(hugepages_2M, hugepages_1G) }}"
vpp_shmmax: "{{ [vpp_calc_shmmax|int, vpp_orig_shmmax|int] | max }}"
vpp_max_map_count: "{{ [vpp_orig_max_map_count|int, vpp_calc_max_map_count|int] | max }}"

Expand Down

0 comments on commit f1cb913

Please sign in to comment.