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.

44 lines
1.2KB

  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. {%- if hugepages.get('mount', False) or hugepages.get('default', False) %}
  17. hugepages_mount_{{ hugepages_type }}:
  18. mount.mounted:
  19. - name: {{ hugepages.mount_point }}
  20. - device: Hugetlbfs-kvm
  21. - fstype: hugetlbfs
  22. - mkmnt: true
  23. - opts: mode=775,pagesize={{ hugepages.size }}
  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. hugepages_sysctl_vm_nr_hugepages:
  27. cmd.run:
  28. - name: "sysctl vm.nr_hugepages={{ hugepages.count }}"
  29. - unless: "sysctl vm.nr_hugepages | grep -qE '{{ hugepages.count }}'"
  30. {%- endif %}
  31. {%- endfor %}
  32. {%- endif %}