@@ -407,6 +407,25 @@ Enable cpufreq governor for every cpu: | |||
cpu: | |||
governor: performance | |||
Sysfs | |||
~~~~~ | |||
Install sysfsutils and set sysfs attributes: | |||
.. code-block:: yaml | |||
linux: | |||
system: | |||
sysfs: | |||
scheduler: | |||
block/sda/queue/scheduler: deadline | |||
power: | |||
mode: | |||
power/state: 0660 | |||
owner: | |||
power/state: "root:power" | |||
devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave | |||
Huge Pages | |||
~~~~~~~~~~~~ | |||
@@ -0,0 +1,16 @@ | |||
# Sysfs file for {{ name }} managed by salt-minion(1) | |||
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN | |||
{%- for key, value in sysfs.iteritems() %} | |||
{%- if key in ["mode", "owner"] %} | |||
{%- for attr, val in value.iteritems() %} | |||
mode {{ attr }} = {{ val }} | |||
{%- endfor %} | |||
{%- else %} | |||
{{ key }} = {{ value }} | |||
{%- endif %} | |||
{%- endfor %} | |||
{#- | |||
vim: syntax=jinja | |||
-#} |
@@ -1,16 +1,8 @@ | |||
{%- from "linux/map.jinja" import system with context %} | |||
{%- if system.cpu.governor is defined %} | |||
linux_sysfs_package: | |||
pkg.installed: | |||
- pkgs: | |||
- sysfsutils | |||
- refresh: true | |||
/etc/sysfs.d: | |||
file.directory: | |||
- require: | |||
- pkg: linux_sysfs_package | |||
include: | |||
- linux.system.sysfs | |||
ondemand_service_disable: | |||
service.dead: |
@@ -30,6 +30,9 @@ include: | |||
{%- if system.cpu is defined %} | |||
- linux.system.cpu | |||
{%- endif %} | |||
{%- if system.sysfs is defined %} | |||
- linux.system.sysfs | |||
{%- endif %} | |||
{%- if system.locale|length > 0 %} | |||
- linux.system.locale | |||
{%- endif %} |
@@ -0,0 +1,42 @@ | |||
{%- from "linux/map.jinja" import system with context %} | |||
linux_sysfs_package: | |||
pkg.installed: | |||
- pkgs: | |||
- sysfsutils | |||
- refresh: true | |||
/etc/sysfs.d: | |||
file.directory: | |||
- require: | |||
- pkg: linux_sysfs_package | |||
{%- for name, sysfs in system.get('sysfs', {}).iteritems() %} | |||
/etc/sysfs.d/{{ name }}.conf: | |||
file.managed: | |||
- source: salt://linux/files/sysfs.conf | |||
- template: jinja | |||
- user: root | |||
- group: root | |||
- mode: 0644 | |||
- defaults: | |||
name: {{ name }} | |||
sysfs: {{ sysfs|yaml }} | |||
- require: | |||
- file: /etc/sysfs.d | |||
{%- for key, value in sysfs.iteritems() %} | |||
{%- if key not in ["mode", "owner"] %} | |||
{%- if grains.get('virtual_subtype', None) not in ['Docker', 'LXC'] %} | |||
{#- Sysfs cannot be set in docker, LXC, etc. #} | |||
linux_sysfs_write_{{ name }}_{{ key }}: | |||
module.run: | |||
- name: sysfs.write | |||
- key: {{ key }} | |||
- value: {{ value }} | |||
{%- endif %} | |||
{%- endif %} | |||
{%- endfor %} | |||
{%- endfor %} |
@@ -15,6 +15,15 @@ linux: | |||
default: "linux.ci.local$" | |||
kernel: | |||
isolcpu: 1,2,3,4 | |||
sysfs: | |||
scheduler: | |||
block/sda/queue/scheduler: deadline | |||
power: | |||
mode: | |||
power/state: 0660 | |||
owner: | |||
power/state: "root:power" | |||
devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave | |||
motd: | |||
- warning: | | |||
#!/bin/sh |