Ver código fonte

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 anos atrás
pai
commit
32b1f7c8fb
5 arquivos alterados com 77 adições e 4 exclusões
  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 Ver arquivo

@@ -317,6 +317,21 @@ Load kernel modules and add them to `/etc/modules`:
- tp_smapi
- 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
not present. Also install extra modules and headers for this kernel:

@@ -346,7 +361,7 @@ Systcl kernel parameters
CPU
~~~

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

.. code-block:: yaml


+ 3
- 0
linux/files/governor.conf.jinja Ver arquivo

@@ -0,0 +1,3 @@
{% 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 Ver arquivo

@@ -0,0 +1,9 @@
{% 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 Ver arquivo

@@ -1,9 +1,40 @@
{%- 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

ondemand_service_disable:
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 Ver arquivo

@@ -53,6 +53,21 @@ linux_kernel_module_{{ module }}:

{%- 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() %}

linux_kernel_{{ sysctl_name }}:

Carregando…
Cancelar
Salvar