Saltstack Official Linux Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hugepages.sls 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {%- from "linux/map.jinja" import system with context %}
  2. include:
  3. - linux.system.grub
  4. {%- if "pse" in grains.cpu_flags or "pdpe1gb" in grains.cpu_flags or "aarch64" in grains.cpuarch %}
  5. /etc/default/grub.d/90-hugepages.cfg:
  6. file.managed:
  7. - source: salt://linux/files/grub_hugepages
  8. - template: jinja
  9. - require:
  10. - file: grub_d_directory
  11. {%- if grains.get('virtual_subtype', None) not in ['Docker', 'LXC'] %}
  12. - watch_in:
  13. - cmd: grub_update
  14. {%- endif %}
  15. {%- for hugepages_type, hugepages in system.kernel.hugepages.items() %}
  16. hugepages_mount_{{ hugepages_type }}:
  17. mount.mounted:
  18. - name: {{ hugepages.mount_point }}
  19. - device: Hugetlbfs-kvm-{{ hugepages.size|lower }}
  20. - fstype: hugetlbfs
  21. - mkmnt: true
  22. - opts: mode=775,pagesize={{ hugepages.size }}
  23. - mount: {{ hugepages.mount|default('true') }}
  24. # Make hugepages available right away with a temporary systctl write
  25. # This will be handled via krn args after reboot, so don't use `sysctl.present`
  26. {%- if hugepages.get('default', False) %}
  27. hugepages_sysctl_vm_nr_hugepages:
  28. cmd.run:
  29. - name: "sysctl vm.nr_hugepages={{ hugepages.count }}"
  30. - unless: "sysctl vm.nr_hugepages | grep -qE '{{ hugepages.count }}'"
  31. {%- endif %}
  32. {%- endfor %}
  33. {%- endif %}
  34. # systemd always creates default mount point at /dev/hugepages
  35. # we have to disable it, as we configure our own mount point for DPDK.
  36. mask_dev_hugepages:
  37. cmd.run:
  38. - name: "systemctl mask dev-hugepages.mount"