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.

43 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. 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 %}