Browse Source

RIL-267 Adding cpu governor and kernel module opts (#101)

* RIL-267 Adding cpu governor and kernel module opts

* RIL-267 Adding cpu governor and kernel module opts

* RIL-267 Adding cpu governor and kernel module opts
pull/102/head
teoyaomiqui 7 years ago
parent
commit
32b1f7c8fb
5 changed files with 77 additions and 4 deletions
  1. +16
    -1
      README.rst
  2. +3
    -0
      linux/files/governor.conf.jinja
  3. +9
    -0
      linux/files/modprobe.conf.jinja
  4. +34
    -3
      linux/system/cpu.sls
  5. +15
    -0
      linux/system/kernel.sls

+ 16
- 1
README.rst View File

- tp_smapi - tp_smapi
- 8021q - 8021q


Configure or blacklist kernel modules with additional options to `/etc/modprobe.d` following example
will add `/etc/modprobe.d/nf_conntrack.conf` file with line `options nf_conntrack hashsize=262144`:

.. code-block:: yaml

linux:
system:
kernel:
module:
nf_conntrack:
option:
hashsize: 262144



Install specific kernel version and ensure all other kernel packages are Install specific kernel version and ensure all other kernel packages are
not present. Also install extra modules and headers for this kernel: not present. Also install extra modules and headers for this kernel:


CPU CPU
~~~ ~~~


Disable ondemand cpu mode service:
Enable cpufreq governor for every cpu:


.. code-block:: yaml .. code-block:: yaml



+ 3
- 0
linux/files/governor.conf.jinja View File

{% for cpu_core in range(salt['grains.get']('num_cpus', 1)) %}
devices/system/cpu/cpu{{ cpu_core }}/cpufreq/scaling_governor = {{ governor }}
{% endfor %}

+ 9
- 0
linux/files/modprobe.conf.jinja View File

{% if module_content.get('blacklist', false) -%}
blacklist {{ module_name }}
{%- else -%}

{%- for option, value in module_content.get('option', {}) | dictsort -%}
options {{ module_name }} {{ option }}={{ value }}
{%- endfor %}

{%- endif %}

+ 34
- 3
linux/system/cpu.sls View File

{%- from "linux/map.jinja" import system with context %} {%- from "linux/map.jinja" import system with context %}
{%- if system.cpu.governor is defined %} {%- 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

ondemand_service_disable: ondemand_service_disable:
service.dead: service.dead:
- name: ondemand
- enable: false
- name: ondemand
- enable: false

/etc/sysfs.d/governor.conf:
file.managed:
- source: salt://linux/files/governor.conf.jinja
- template: jinja
- user: root
- group: root
- mode: 0644
- defaults:
governor: {{ system.cpu.governor }}

{% for cpu_core in range(salt['grains.get']('num_cpus', 1)) %}

governor_write_sysfs_cpu_core_{{ cpu_core }}:
module.run:
- name: sysfs.write
- key: devices/system/cpu/cpu{{ cpu_core }}/cpufreq/scaling_governor
- value: {{ system.cpu.governor }}

{%- endfor %}


{%- endif %}
{%- endif %}

+ 15
- 0
linux/system/kernel.sls View File



{%- endfor %} {%- endfor %}


{%- for module_name, module_content in system.kernel.get('module', {}).iteritems() %}

/etc/modprobe.d/{{ module_name }}.conf:
file.managed:
- user: root
- group: root
- mode: 0644
- template: jinja
- source: salt://linux/files/modprobe.conf.jinja
- defaults:
module_content: {{ module_content }}
module_name: {{ module_name }}

{%- endfor %}

{%- for sysctl_name, sysctl_value in system.kernel.get('sysctl', {}).iteritems() %} {%- for sysctl_name, sysctl_value in system.kernel.get('sysctl', {}).iteritems() %}


linux_kernel_{{ sysctl_name }}: linux_kernel_{{ sysctl_name }}:

Loading…
Cancel
Save