diff --git a/.packit.yaml b/.packit.yaml index 0cc8cc2..938308e 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -5,15 +5,17 @@ jobs: metadata: targets: - fedora-all + - epel-7-x86_64 - epel-8-x86_64 - - centos-stream-8-x86_64 + - centos-stream-9-x86_64 - job: tests trigger: pull_request metadata: targets: - fedora-all + - epel-7-x86_64 - epel-8-x86_64 - - centos-stream-8-x86_64 + - centos-stream-9-x86_64 synced_files: - tuned.spec diff --git a/92-tuned.install b/92-tuned.install index 2b0a96c..0f7bdf3 100755 --- a/92-tuned.install +++ b/92-tuned.install @@ -19,9 +19,7 @@ LOADER_ENTRIES="$BOOT_ROOT/loader/entries" [ "$COMMAND" = "add" ] || exit 0 -# The zipl bootloader doesn't support variables ARCH=`uname -m` -[ "${ARCH:0:4}" = "s390" ] && exit 0 pushd "$LOADER_ENTRIES" &> /dev/null for f in `basename "$MACHINE_ID"`-*.conf; do @@ -33,8 +31,18 @@ for f in `basename "$MACHINE_ID"`-*.conf; do if [[ "$f" =~ \w*-[0-9a-f]{7,}-.*-.*.conf ]]; then continue fi - grep -q '^\s*options\s\+.*\$tuned_params' "$f" || sed -i '/^\s*options\s\+/ s/\(.*\)/\1 \$tuned_params/' "$f" - grep -q '^\s*initrd\s\+.*\$tuned_initrd' "$f" || sed -i '/^\s*initrd\s\+/ s/\(.*\)/\1 \$tuned_initrd/' "$f" + + if [ "${ARCH:0:4}" = "s390" ]; then + # On s390(x), the zipl bootloader doesn't support variables, + # unpatch TuneD variables which could be there from the previous TuneD + # versions + grep -q '^\s*options\s\+.*\$tuned_params' "$f" && sed -i '/^\s*options\s\+/ s/\s\+\$tuned_params\b//g' "$f" + grep -q '^\s*initrd\s\+.*\$tuned_initrd' "$f" && sed -i '/^\s*initrd\s\+/ s/\s\+\$tuned_initrd\b//g' "$f" + else + # Not on s390(x), add TuneD variables if they are not there + grep -q '^\s*options\s\+.*\$tuned_params' "$f" || sed -i '/^\s*options\s\+/ s/\(.*\)/\1 \$tuned_params/' "$f" + grep -q '^\s*initrd\s\+.*\$tuned_initrd' "$f" || sed -i '/^\s*initrd\s\+/ s/\(.*\)/\1 \$tuned_initrd/' "$f" + fi done popd &> /dev/null diff --git a/README b/README index 0baa9b4..b4fc629 100644 --- a/README +++ b/README @@ -6,10 +6,13 @@ version, please check out branch '1.0' in our Git repository.) How to use it ------------- +TuneD is incompatible with the cpupower and power-profiles-daemon. If you +have these services, uninstall or disable them. + In Fedora, Red Hat Enterprise Linux, and their derivates install tuned package (optionally tuned-utils, tuned-utils-systemtap, and tuned-profiles-compat): -# yum install tuned +# dnf install tuned After the installation, start the tuned service: diff --git a/doc/manual/assemblies/assembly_customizing-tuned-profiles.adoc b/doc/manual/assemblies/assembly_customizing-tuned-profiles.adoc index 08a2082..7e46e7c 100644 --- a/doc/manual/assemblies/assembly_customizing-tuned-profiles.adoc +++ b/doc/manual/assemblies/assembly_customizing-tuned-profiles.adoc @@ -5,15 +5,28 @@ :context: customizing-tuned-profiles +[role="_abstract"] You can create or modify *TuneD* profiles to optimize system performance for your intended use case. .Prerequisites -* Install and enable *TuneD* as described in xref:installing-and-enabling-tuned_getting-started-with-tuned[]. +ifndef::pantheonenv[] +* Install and enable *TuneD* as described in xref:installing-and-enabling-tuned_getting-started-with-tuned[Installing and Enabling Tuned] for details. +endif::[] + +ifdef::pantheonenv[] +* Install and enable *TuneD* as described in xref:modules/performance/proc_installing-and-enabling-tuned.adoc[Installing and Enabling Tuned] for details. +endif::[] include::modules/performance/con_tuned-profiles.adoc[leveloffset=+1] +include::modules/performance/con_the-default-tuned-profile.adoc[leveloffset=+1] + +include::modules/performance/con_merged-tuned-profiles.adoc[leveloffset=+1] + +include::modules/performance/con_the-location-of-tuned-profiles.adoc[leveloffset=+1] + include::modules/performance/con_inheritance-between-tuned-profiles.adoc[leveloffset=+1] include::modules/performance/con_static-and-dynamic-tuning-in-tuned.adoc[leveloffset=+1] @@ -22,7 +35,9 @@ include::modules/performance/con_tuned-plug-ins.adoc[leveloffset=+1] include::modules/performance/ref_available-tuned-plug-ins.adoc[leveloffset=+1] -include::modules/performance/con_variables-and-built-in-functions-in-tuned-profiles.adoc[leveloffset=+1] +include::modules/performance/con_variables-in-tuned-profiles.adoc[leveloffset=+1] + +include::modules/performance/con_built-in-functions-in-tuned-profiles.adoc[leveloffset=+1] include::modules/performance/ref_built-in-functions-available-in-tuned-profiles.adoc[leveloffset=+1] @@ -32,11 +47,12 @@ include::modules/performance/proc_modifying-existing-tuned-profiles.adoc[levelof include::modules/performance/proc_setting-the-disk-scheduler-using-tuned.adoc[leveloffset=+1] - +ifdef::upstream[] [id='related-information-{context}'] == Related information * The `tuned.conf(5)` man page * The *TuneD* project website: link:https://tuned-project.org/[] +endif::[] :context: {parent-context-of-customizing-tuned-profiles} diff --git a/doc/manual/assemblies/assembly_getting-started-with-tuned.adoc b/doc/manual/assemblies/assembly_getting-started-with-tuned.adoc index 9a57dd4..cd3adb5 100644 --- a/doc/manual/assemblies/assembly_getting-started-with-tuned.adoc +++ b/doc/manual/assemblies/assembly_getting-started-with-tuned.adoc @@ -5,10 +5,11 @@ :context: getting-started-with-tuned +[role="_abstract"] As a system administrator, you can use the *TuneD* application to optimize the performance profile of your system for a variety of use cases. // .Prerequisites -// +// // * A bulleted list of conditions that must be satisfied before the user starts following this assembly. // * You can also link to other modules or assemblies the user must follow before starting this assembly. // * Delete the section title and bullets if the assembly has no prerequisites. @@ -18,8 +19,16 @@ include::modules/performance/con_the-purpose-of-tuned.adoc[leveloffset=+1] include::modules/performance/con_tuned-profiles.adoc[leveloffset=+1] +include::modules/performance/con_the-default-tuned-profile.adoc[leveloffset=+1] + +include::modules/performance/con_merged-tuned-profiles.adoc[leveloffset=+1] + +include::modules/performance/con_the-location-of-tuned-profiles.adoc[leveloffset=+1] + include::modules/performance/ref_tuned-profiles-distributed-with-rhel.adoc[leveloffset=+1] +include::modules/performance/ref_real-time-tuned-profiles-distributed-with-rhel.adoc[leveloffset=+1] + include::modules/performance/con_static-and-dynamic-tuning-in-tuned.adoc[leveloffset=+1] include::modules/performance/con_tuned-no-daemon-mode.adoc[leveloffset=+1] @@ -32,12 +41,13 @@ include::modules/performance/proc_setting-a-tuned-profile.adoc[leveloffset=+1] include::modules/performance/proc_disabling-tuned.adoc[leveloffset=+1] - +ifdef::upstream[] [id='related-information-{context}'] == Related information * The `tuned(8)` man page * The `tuned-adm(8)` man page * The *TuneD* project website: link:https://tuned-project.org/[] +endif::[] :context: {parent-context-of-getting-started-with-tuned} diff --git a/doc/manual/modules/performance/con_built-in-functions-in-tuned-profiles.adoc b/doc/manual/modules/performance/con_built-in-functions-in-tuned-profiles.adoc new file mode 100644 index 0000000..b88f847 --- /dev/null +++ b/doc/manual/modules/performance/con_built-in-functions-in-tuned-profiles.adoc @@ -0,0 +1,46 @@ +:_module-type: CONCEPT +[id="built-in-functions-in-tuned-profiles_{context}"] += Built-in functions in TuneD profiles + +[role="_abstract"] +Built-in functions expand at run time when a *TuneD* profile is activated. + +You can: + +* Use various built-in functions together with *TuneD* variables +* Create custom functions in Python and add them to *TuneD* in the form of plug-ins + +To call a function, use the following syntax: + +[subs=+quotes] +---- +${f:[replaceable]__function_name__:[replaceable]__argument_1__:[replaceable]__argument_2__} +---- + +To expand the directory path where the profile and the `tuned.conf` file are located, use the `PROFILE_DIR` function, which requires special syntax: + +---- +${i:PROFILE_DIR} +---- + + + +.Isolating CPU cores using variables and built-in functions +==== +In the following example, the `${non_isolated_cores}` variable expands to `0,3-5`, and the `cpulist_invert` built-in function is called with the `0,3-5` argument: + +---- +[variables] +non_isolated_cores=0,3-5 + +[bootloader] +cmdline=isolcpus=${f:cpulist_invert:${non_isolated_cores}} +---- + +The `cpulist_invert` function inverts the list of CPUs. For a 6-CPU machine, the inversion is `1,2`, and the kernel boots with the [option]`isolcpus=1,2` command-line option. + +==== + +[role="_additional-resources"] +.Additional resources +* `tuned.conf(5)` man page diff --git a/doc/manual/modules/performance/con_inheritance-between-tuned-profiles.adoc b/doc/manual/modules/performance/con_inheritance-between-tuned-profiles.adoc index 2a76cce..63517ac 100644 --- a/doc/manual/modules/performance/con_inheritance-between-tuned-profiles.adoc +++ b/doc/manual/modules/performance/con_inheritance-between-tuned-profiles.adoc @@ -1,6 +1,8 @@ +:_module-type: CONCEPT [id="inheritance-between-tuned-profiles_{context}"] = Inheritance between TuneD profiles +[role="_abstract"] *TuneD* profiles can be based on other profiles and modify only certain aspects of their parent profile. The `[main]` section of *TuneD* profiles recognizes the [option]`include` option: @@ -15,7 +17,7 @@ All settings from the [replaceable]_parent_ profile are loaded in this _child_ p You can create your own _child_ profile in the [filename]`/etc/tuned/` directory based on a pre-installed profile in [filename]`/usr/lib/tuned/` with only some parameters adjusted. -If the [replaceable]_parent_ profile is updated, such as after a *TuneD* upgrade, the changes are reflected in the _child_ profile. +If the [replaceable]_parent_ profile is updated, such as after a *TuneD* upgrade, the changes are reflected in the _child_ profile. .A power-saving profile based on balanced @@ -31,8 +33,6 @@ alpm=min_power ---- ==== - +[role="_additional-resources"] .Additional resources - -* The `tuned.conf(5)` man page - +* `tuned.conf(5)` man page diff --git a/doc/manual/modules/performance/con_merged-tuned-profiles.adoc b/doc/manual/modules/performance/con_merged-tuned-profiles.adoc new file mode 100644 index 0000000..512b6bc --- /dev/null +++ b/doc/manual/modules/performance/con_merged-tuned-profiles.adoc @@ -0,0 +1,23 @@ +:_module-type: CONCEPT +[id="merged-tuned-profiles_{context}"] += Merged TuneD profiles + +[role="_abstract"] +As an experimental feature, it is possible to select more profiles at once. *TuneD* will try to merge them during the load. + +If there are conflicts, the settings from the last specified profile takes precedence. + +.Low power consumption in a virtual guest +==== +The following example optimizes the system to run in a virtual machine for the best performance and concurrently tunes it for low power consumption, while the low power consumption is the priority: + +---- +# tuned-adm profile virtual-guest powersave +---- +==== + +WARNING: Merging is done automatically without checking whether the resulting combination of parameters makes sense. Consequently, the feature might tune some parameters the opposite way, which might be counterproductive: for example, setting the disk for high throughput by using the `throughput-performance` profile and concurrently setting the disk spindown to the low value by the `spindown-disk` profile. + +[role="_additional-resources"] +.Additional resources +* `tuned.conf(5)` man page. diff --git a/doc/manual/modules/performance/con_static-and-dynamic-tuning-in-tuned.adoc b/doc/manual/modules/performance/con_static-and-dynamic-tuning-in-tuned.adoc index 36adfe8..40987e4 100644 --- a/doc/manual/modules/performance/con_static-and-dynamic-tuning-in-tuned.adoc +++ b/doc/manual/modules/performance/con_static-and-dynamic-tuning-in-tuned.adoc @@ -1,6 +1,8 @@ +:_module-type: CONCEPT [id="static-and-dynamic-tuning-in-tuned_{context}"] = Static and dynamic tuning in TuneD +[role="_abstract"] This section explains the difference between the two categories of system tuning that *TuneD* applies: _static_ and _dynamic_. // TODO: Move some of this content into a separate module ("Enabling dynamic tuning"). It seems to be necessary to (1) enable dynamic tuning globally *and* (2) manually enable it in performance-oriented profiles. @@ -32,7 +34,7 @@ This principle is used for other plug-ins for CPU and disks as well. // .Additional resources -// +// // * A bulleted list of links to other material closely related to the contents of the concept module. // * For more details on writing concept modules, see the link:https://github.com/redhat-documentation/modular-docs#modular-documentation-reference-guide[Modular Documentation Reference Guide]. // * Use a consistent system for file names, IDs, and titles. For tips, see _Anchor Names and File Names_ in link:https://github.com/redhat-documentation/modular-docs#modular-documentation-reference-guide[Modular Documentation Reference Guide]. diff --git a/doc/manual/modules/performance/con_the-default-tuned-profile.adoc b/doc/manual/modules/performance/con_the-default-tuned-profile.adoc new file mode 100644 index 0000000..a5823c4 --- /dev/null +++ b/doc/manual/modules/performance/con_the-default-tuned-profile.adoc @@ -0,0 +1,18 @@ +:_module-type: CONCEPT +[id="the-default-tuned-profile_{context}"] += The default TuneD profile + +[role="_abstract"] +During the installation, the best profile for your system is selected automatically. Currently, the default profile is selected according to the following customizable rules: + +[options="header",cols="2,2,3"] +|=== +| Environment | Default profile | Goal +| Compute nodes | `throughput-performance` | The best throughput performance +| Virtual machines | `virtual-guest` | The best performance. If you are not interested in the best performance, you can change it to the `balanced` or `powersave` profile. +| Other cases | `balanced` | Balanced performance and power consumption +|=== + +[role="_additional-resources"] +.Additional resources +* `tuned.conf(5)` man page. diff --git a/doc/manual/modules/performance/con_the-location-of-tuned-profiles.adoc b/doc/manual/modules/performance/con_the-location-of-tuned-profiles.adoc new file mode 100644 index 0000000..e428861 --- /dev/null +++ b/doc/manual/modules/performance/con_the-location-of-tuned-profiles.adoc @@ -0,0 +1,16 @@ +:_module-type: CONCEPT +[id="the-location-of-tuned-profiles_{context}"] += The location of TuneD profiles + +[role="_abstract"] +*TuneD* stores profiles in the following directories: + +[filename]`/usr/lib/tuned/`:: +Distribution-specific profiles are stored in the directory. Each profile has its own directory. The profile consists of the main configuration file called `tuned.conf`, and optionally other files, for example helper scripts. + +[filename]`/etc/tuned/`:: +If you need to customize a profile, copy the profile directory into the directory, which is used for custom profiles. If there are two profiles of the same name, the custom profile located in [filename]`/etc/tuned/` is used. + +[role="_additional-resources"] +.Additional resources +* `tuned.conf(5)` man page. diff --git a/doc/manual/modules/performance/con_the-purpose-of-tuned.adoc b/doc/manual/modules/performance/con_the-purpose-of-tuned.adoc index e7c832b..1b72af2 100644 --- a/doc/manual/modules/performance/con_the-purpose-of-tuned.adoc +++ b/doc/manual/modules/performance/con_the-purpose-of-tuned.adoc @@ -1,6 +1,8 @@ +:_module-type: CONCEPT [id="the-purpose-of-tuned_{context}"] = The purpose of TuneD +[role="_abstract"] *TuneD* is a service that monitors your system and optimizes the performance under certain workloads. The core of *TuneD* are _profiles_, which tune your system for different use cases. *TuneD* is distributed with a number of predefined profiles for use cases such as: @@ -16,7 +18,7 @@ You can also configure *TuneD* to react to changes in device usage and adjusts s // The TuneD tuning service can adapt the operating system to perform better under certain workloads by setting a tuning profile. // .Additional resources -// +// // * A bulleted list of links to other material closely related to the contents of the concept module. // * For more details on writing concept modules, see the link:https://github.com/redhat-documentation/modular-docs#modular-documentation-reference-guide[Modular Documentation Reference Guide]. // * Use a consistent system for file names, IDs, and titles. For tips, see _Anchor Names and File Names_ in link:https://github.com/redhat-documentation/modular-docs#modular-documentation-reference-guide[Modular Documentation Reference Guide]. diff --git a/doc/manual/modules/performance/con_tuned-no-daemon-mode.adoc b/doc/manual/modules/performance/con_tuned-no-daemon-mode.adoc index 34b22ac..bfda163 100644 --- a/doc/manual/modules/performance/con_tuned-no-daemon-mode.adoc +++ b/doc/manual/modules/performance/con_tuned-no-daemon-mode.adoc @@ -1,8 +1,10 @@ +:_module-type: CONCEPT [id="tuned-no-daemon-mode_{context}"] = TuneD no-daemon mode // TODO: Should this be a procedure? A user story? Is there a common use case? +[role="_abstract"] You can run *TuneD* in `no-daemon` mode, which does not require any resident memory. In this mode, *TuneD* applies the settings and exits. By default, `no-daemon` mode is disabled because a lot of *TuneD* functionality is missing in this mode, including: @@ -18,7 +20,7 @@ daemon = 0 ---- // .Additional resources -// +// // * A bulleted list of links to other material closely related to the contents of the concept module. // * For more details on writing concept modules, see the link:https://github.com/redhat-documentation/modular-docs#modular-documentation-reference-guide[Modular Documentation Reference Guide]. // * Use a consistent system for file names, IDs, and titles. For tips, see _Anchor Names and File Names_ in link:https://github.com/redhat-documentation/modular-docs#modular-documentation-reference-guide[Modular Documentation Reference Guide]. diff --git a/doc/manual/modules/performance/con_tuned-plug-ins.adoc b/doc/manual/modules/performance/con_tuned-plug-ins.adoc index 57222fe..fcdcbe8 100644 --- a/doc/manual/modules/performance/con_tuned-plug-ins.adoc +++ b/doc/manual/modules/performance/con_tuned-plug-ins.adoc @@ -1,24 +1,19 @@ +:_module-type: CONCEPT [id="tuned-plug-ins_{context}"] = TuneD plug-ins +[role="_abstract"] Plug-ins are modules in *TuneD* profiles that *TuneD* uses to monitor or optimize different devices on the system. *TuneD* uses two types of plug-ins: -* monitoring plug-ins -* tuning plug-ins - -[discrete] -== Monitoring plug-ins - +Monitoring plug-ins:: Monitoring plug-ins are used to get information from a running system. The output of the monitoring plug-ins can be used by tuning plug-ins for dynamic tuning. - ++ Monitoring plug-ins are automatically instantiated whenever their metrics are needed by any of the enabled tuning plug-ins. If two tuning plug-ins require the same data, only one instance of the monitoring plug-in is created and the data is shared. -[discrete] -== Tuning plug-ins - -Each tuning plug-in tunes an individual subsystem and takes several parameters that are populated from the TuneD profiles. Each subsystem can have multiple devices, such as multiple CPUs or network cards, that are handled by individual instances of the tuning plug-ins. Specific settings for individual devices are also supported. +Tuning plug-ins:: +Each tuning plug-in tunes an individual subsystem and takes several parameters that are populated from the TuneD profiles. Each subsystem can have multiple devices, such as multiple CPUs or network cards, that are handled by individual instances of the tuning plug-ins. Specific settings for individual devices are also supported. [discrete] == Syntax for plug-ins in TuneD profiles @@ -33,13 +28,13 @@ devices=_DEVICES_ ---- NAME:: -is the name of the plug-in instance as it is used in the logs. It can be an arbitrary string. +is the name of the plug-in instance as it is used in the logs. It can be an arbitrary string. TYPE:: -is the type of the tuning plug-in. +is the type of the tuning plug-in. DEVICES:: -is the list of devices that this plug-in instance handles. +is the list of devices that this plug-in instance handles. + The `devices` line can contain a list, a wildcard (`\*`), and negation (`!`). If there is no `devices` line, all devices present or later attached on the system of the [replaceable]_TYPE_ are handled by the plug-in instance. This is same as using the [option]`devices=*` option. + @@ -59,13 +54,13 @@ The following example matches all block devices except `sda1` and `sda2`: ---- [data_disk] type=disk -devices=!sda1, !sda2 +devices=!sda1, !sda2 disable_barriers=false ---- ==== -If no instance of a plug-in is specified, the plug-in is not enabled. +If no instance of a plug-in is specified, the plug-in is not enabled. If the plug-in supports more options, they can be also specified in the plug-in section. If the option is not specified and it was not previously specified in the included plug-in, the default value is used. @@ -98,14 +93,11 @@ If the same section is specified more than once using the `include` option, the You can also disable the plug-in by specifying the [option]`enabled=false` option. This has the same effect as if the instance was never defined. Disabling the plug-in is useful if you are redefining the previous definition from the [option]`include` option and do not want the plug-in to be active in your custom profile. -[discrete] -== Functionality not implemented in any plug-in - +NOTE:: *TuneD* includes the ability to run any shell command as part of enabling or disabling a tuning profile. This enables you to extend *TuneD* profiles with functionality that has not been integrated into TuneD yet. - ++ You can specify arbitrary shell commands using the `script` plug-in. +[role="_additional-resources"] .Additional resources - -* The `tuned.conf(5)` man page - +* `tuned.conf(5)` man page diff --git a/doc/manual/modules/performance/con_tuned-profiles.adoc b/doc/manual/modules/performance/con_tuned-profiles.adoc index fa07f68..ee55206 100644 --- a/doc/manual/modules/performance/con_tuned-profiles.adoc +++ b/doc/manual/modules/performance/con_tuned-profiles.adoc @@ -1,6 +1,8 @@ +:_module-type: CONCEPT [id="tuned-profiles_{context}"] = TuneD profiles +[role="_abstract"] A detailed analysis of a system can be very time-consuming. *TuneD* provides a number of predefined profiles for typical use cases. You can also create, modify, and delete profiles. The profiles provided with *TuneD* are divided into the following categories: @@ -16,57 +18,12 @@ The performance-boosting profiles include profiles that focus on the following a * Virtualization host performance [discrete] -== The default profile - -During the installation, the best profile for your system is selected automatically. Currently, the default profile is selected according to the following customizable rules: - -[options="header",cols="2,2,3"] -|=== -| Environment | Default profile | Goal -| Compute nodes | `throughput-performance` | The best throughput performance -| Virtual machines | `virtual-guest` | The best performance. If you are not interested in the best performance, you can change it to the `balanced` or `powersave` profile. -| Other cases | `balanced` | Balanced performance and power consumption -|=== - - -[discrete] -== Merged profiles - -As an experimental feature, it is possible to select more profiles at once. *TuneD* will try to merge them during the load. - -If there are conflicts, the settings from the last specified profile takes precedence. - -.Low power consumption in a virtual guest -==== -The following example optimizes the system to run in a virtual machine for the best performance and concurrently tunes it for low power consumption, while the low power consumption is the priority: - ----- -# tuned-adm profile virtual-guest powersave ----- -==== - -WARNING: Merging is done automatically without checking whether the resulting combination of parameters makes sense. Consequently, the feature might tune some parameters the opposite way, which might be counterproductive: for example, setting the disk for high throughput by using the `throughput-performance` profile and concurrently setting the disk spindown to the low value by the `spindown-disk` profile. - -[discrete] -== The location of profiles - -*TuneD* stores profiles in the following directories: - -[filename]`/usr/lib/tuned/`:: -Distribution-specific profiles are stored in the directory. Each profile has its own directory. The profile consists of the main configuration file called `tuned.conf`, and optionally other files, for example helper scripts. - -[filename]`/etc/tuned/`:: -If you need to customize a profile, copy the profile directory into the directory, which is used for custom profiles. If there are two profiles of the same name, the custom profile located in [filename]`/etc/tuned/` is used. - - -[discrete] -== The syntax of profile configuration +== Syntax of profile configuration The `tuned.conf` file can contain one `[main]` section and other sections for configuring plug-in instances. However, all sections are optional. Lines starting with the hash sign (`#`) are comments. +[role="_additional-resources"] .Additional resources - -* The `tuned.conf(5)` man page. - +* `tuned.conf(5)` man page. diff --git a/doc/manual/modules/performance/con_variables-in-tuned-profiles.adoc b/doc/manual/modules/performance/con_variables-in-tuned-profiles.adoc new file mode 100644 index 0000000..424238c --- /dev/null +++ b/doc/manual/modules/performance/con_variables-in-tuned-profiles.adoc @@ -0,0 +1,55 @@ +:_module-type: CONCEPT +[id="variables-in-tuned-profiles_{context}"] += Variables in TuneD profiles + +[role="_abstract"] +Variables expand at run time when a *TuneD* profile is activated. + +Using *TuneD* variables reduces the amount of necessary typing in *TuneD* profiles. + +There are no predefined variables in *TuneD* profiles. You can define your own variables by creating the `[variables]` section in a profile and using the following syntax: + +[subs=+quotes] +---- +[variables] + +[replaceable]__variable_name__=[replaceable]__value__ +---- + +To expand the value of a variable in a profile, use the following syntax: + +[subs=+quotes] +---- +${[replaceable]__variable_name__} +---- + +.Isolating CPU cores using variables +==== +In the following example, the `${isolated_cores}` variable expands to `1,2`; hence the kernel boots with the [option]`isolcpus=1,2` option: + +---- +[variables] +isolated_cores=1,2 + +[bootloader] +cmdline=isolcpus=${isolated_cores} +---- + +The variables can be specified in a separate file. For example, you can add the following lines to [filename]`tuned.conf`: + +[subs=+quotes] +---- +[variables] +include=/etc/tuned/[replaceable]_my-variables.conf_ + +[bootloader] +cmdline=isolcpus=${isolated_cores} +---- + +If you add the [option]`isolated_cores=1,2` option to the [filename]`/etc/tuned/my-variables.conf` file, the kernel boots with the [option]`isolcpus=1,2` option. + +==== + +[role="_additional-resources"] +.Additional resources +* `tuned.conf(5)` man page diff --git a/doc/manual/modules/performance/proc_creating-new-tuned-profiles.adoc b/doc/manual/modules/performance/proc_creating-new-tuned-profiles.adoc index 53bae73..9142e16 100644 --- a/doc/manual/modules/performance/proc_creating-new-tuned-profiles.adoc +++ b/doc/manual/modules/performance/proc_creating-new-tuned-profiles.adoc @@ -1,11 +1,19 @@ +:_module-type: PROCEDURE [id="creating-new-tuned-profiles_{context}"] = Creating new TuneD profiles +[role="_abstract"] This procedure creates a new *TuneD* profile with custom performance rules. .Prerequisites -* The `tuned` service is installed and running. See xref:installing-and-enabling-tuned_getting-started-with-tuned[] for details. +ifndef::pantheonenv[] +* The `tuned` service is running. See xref:installing-and-enabling-tuned_getting-started-with-tuned[Installing and Enabling Tuned] for details. +endif::[] + +ifdef::pantheonenv[] +* The `tuned` service is running. See xref:modules/performance/proc_installing-and-enabling-tuned.adoc[Installing and Enabling Tuned] for details. +endif::[] .Procedure @@ -61,7 +69,6 @@ Verfication succeeded, current system settings match the preset profile. See TuneD log file ('/var/log/tuned/tuned.log') for details. ---- +[role="_additional-resources"] .Additional resources - -* The `tuned.conf(5)` man page - +* `tuned.conf(5)` man page diff --git a/doc/manual/modules/performance/proc_disabling-tuned.adoc b/doc/manual/modules/performance/proc_disabling-tuned.adoc index 6b1f741..3bd8661 100644 --- a/doc/manual/modules/performance/proc_disabling-tuned.adoc +++ b/doc/manual/modules/performance/proc_disabling-tuned.adoc @@ -1,10 +1,12 @@ +:_module-type: PROCEDURE [id="disabling-tuned_{context}"] = Disabling TuneD +[role="_abstract"] This procedure disables *TuneD* and resets all affected system settings to their original state before *TuneD* modified them. // .Prerequisites -// +// // * A bulleted list of conditions that must be satisfied before the user starts following this assembly. // * You can also link to other modules or assemblies the user must follow before starting this assembly. // * Delete the section title and bullets if the assembly has no prerequisites. @@ -25,7 +27,6 @@ The tunings are applied again after the `tuned` service restarts. # systemctl disable --now tuned ---- +[role="_additional-resources"] .Additional resources - -* The `tuned-adm(8)` man page. - +* `tuned-adm(8)` man page diff --git a/doc/manual/modules/performance/proc_installing-and-enabling-tuned.adoc b/doc/manual/modules/performance/proc_installing-and-enabling-tuned.adoc index 6b198d6..4c7df29 100644 --- a/doc/manual/modules/performance/proc_installing-and-enabling-tuned.adoc +++ b/doc/manual/modules/performance/proc_installing-and-enabling-tuned.adoc @@ -1,10 +1,12 @@ +:_module-type: PROCEDURE [id="installing-and-enabling-tuned_{context}"] = Installing and enabling TuneD +[role="_abstract"] This procedure installs and enables the *TuneD* application, installs *TuneD* profiles, and presets a default *TuneD* profile for your system. // .Prerequisites -// +// // * A bulleted list of conditions that must be satisfied before the user starts following this assembly. // * You can also link to other modules or assemblies the user must follow before starting this assembly. // * Delete the section title and bullets if the assembly has no prerequisites. @@ -47,6 +49,5 @@ See TuneD log file ('/var/log/tuned/tuned.log') for details. // .Additional resources -// +// // * The `tuned-adm(8)` man page. - diff --git a/doc/manual/modules/performance/proc_listing-available-tuned-profiles.adoc b/doc/manual/modules/performance/proc_listing-available-tuned-profiles.adoc index 38cc38e..1f4f228 100644 --- a/doc/manual/modules/performance/proc_listing-available-tuned-profiles.adoc +++ b/doc/manual/modules/performance/proc_listing-available-tuned-profiles.adoc @@ -1,6 +1,8 @@ +:_module-type: PROCEDURE [id="listing-available-tuned-profiles_{context}"] = Listing available TuneD profiles +[role="_abstract"] This procedure lists all *TuneD* profiles that are currently available on your system. //No prerequisites are needed @@ -40,7 +42,6 @@ $ *tuned-adm active* Current active profile: [replaceable]_balanced_ ---- +[role="_additional-resources"] .Additional resources - * The `tuned-adm(8)` man page. - diff --git a/doc/manual/modules/performance/proc_modifying-existing-tuned-profiles.adoc b/doc/manual/modules/performance/proc_modifying-existing-tuned-profiles.adoc index 639942e..5ac005f 100644 --- a/doc/manual/modules/performance/proc_modifying-existing-tuned-profiles.adoc +++ b/doc/manual/modules/performance/proc_modifying-existing-tuned-profiles.adoc @@ -1,11 +1,19 @@ +:_module-type: PROCEDURE [id="modifying-existing-tuned-profiles_{context}"] = Modifying existing TuneD profiles +[role="_abstract"] This procedure creates a modified child profile based on an existing *TuneD* profile. .Prerequisites -* The `tuned` service is installed and running. See xref:installing-and-enabling-tuned_getting-started-with-tuned[] for details. +ifndef::pantheonenv[] +* The `tuned` service is running. See xref:installing-and-enabling-tuned_getting-started-with-tuned[Installing and Enabling Tuned] for details. +endif::[] + +ifdef::pantheonenv[] +* The `tuned` service is running. See xref:modules/performance/proc_installing-and-enabling-tuned.adoc[Installing and Enabling Tuned] for details. +endif::[] .Procedure @@ -72,10 +80,9 @@ See TuneD log file ('/var/log/tuned/tuned.log') for details. // ---- // # cp -r /usr/lib/tuned/throughput-performance /etc/tuned // ---- -// -// . Then, edit the profile in /etc/tuned according to your needs. Note that if there are two profiles of the same name, the profile located in /etc/tuned/ is loaded. The disadvantage of this approach is that if a system profile is updated after a TuneD upgrade, the changes will not be reflected in the now-outdated modified version. +// +// . Then, edit the profile in /etc/tuned according to your needs. Note that if there are two profiles of the same name, the profile located in /etc/tuned/ is loaded. The disadvantage of this approach is that if a system profile is updated after a TuneD upgrade, the changes will not be reflected in the now-outdated modified version. +[role="_additional-resources"] .Additional resources - -* The `tuned.conf(5)` man page - +* `tuned.conf(5)` man page diff --git a/doc/manual/modules/performance/proc_setting-a-tuned-profile.adoc b/doc/manual/modules/performance/proc_setting-a-tuned-profile.adoc index 26f4e2e..080e68f 100644 --- a/doc/manual/modules/performance/proc_setting-a-tuned-profile.adoc +++ b/doc/manual/modules/performance/proc_setting-a-tuned-profile.adoc @@ -1,11 +1,19 @@ +:_module-type: PROCEDURE [id="setting-a-tuned-profile_{context}"] = Setting a TuneD profile +[role="_abstract"] This procedure activates a selected *TuneD* profile on your system. .Prerequisites -* The `tuned` service is running. See xref:installing-and-enabling-tuned_{context}[] for details. +ifndef::pantheonenv[] +* The `tuned` service is running. See xref:installing-and-enabling-tuned_getting-started-with-tuned[Installing and Enabling Tuned] for details. +endif::[] + +ifdef::pantheonenv[] +* The `tuned` service is running. See xref:modules/performance/proc_installing-and-enabling-tuned.adoc[Installing and Enabling Tuned] for details. +endif::[] .Procedure @@ -68,7 +76,6 @@ See TuneD log file ('/var/log/tuned/tuned.log') for details. ---- +[role="_additional-resources"] .Additional resources - -* The `tuned-adm(8)` man page - +* `tuned-adm(8)` man page diff --git a/doc/manual/modules/performance/proc_setting-the-disk-scheduler-using-tuned.adoc b/doc/manual/modules/performance/proc_setting-the-disk-scheduler-using-tuned.adoc index dbed8a3..72a3e66 100644 --- a/doc/manual/modules/performance/proc_setting-the-disk-scheduler-using-tuned.adoc +++ b/doc/manual/modules/performance/proc_setting-the-disk-scheduler-using-tuned.adoc @@ -1,6 +1,8 @@ +:_module-type: PROCEDURE [id="setting-the-disk-scheduler-using-tuned_{context}"] = Setting the disk scheduler using TuneD +[role="_abstract"] This procedure creates and enables a *TuneD* profile that sets a given disk scheduler for selected block devices. The setting persists across system reboots. In the following commands and configuration, replace: @@ -10,9 +12,14 @@ In the following commands and configuration, replace: .Prerequisites -// Use an xref if we're inside the performance title or the upstream TuneD manual. +// Use an xref if we're inside the performance title or the upstream Tuned manual. Wrap performance title inside pantheonenv[] ifndef. Use pantheonenv[] ifdef to use correct xref syntax for PV2. +ifndef::pantheonenv[] ifdef::performance-title[] -:installing-tuned-link: pass:macros[xref:installing-and-enabling-tuned_getting-started-with-tuned[]] +:installing-tuned-link: pass:macros[xref:installing-and-enabling-tuned_getting-started-with-tuned[Installing and enabling Tuned]] +endif::[] +endif::[] +ifdef::pantheonenv[] +:installing-tuned-link: pass:macros[xref:modules/performance/proc_installing-and-enabling-tuned.adoc[Installing and enabling Tuned]] endif::[] ifdef::upstream[] :installing-tuned-link: pass:macros[xref:installing-and-enabling-tuned_getting-started-with-tuned[]] @@ -23,15 +30,18 @@ ifndef::performance-title[] :installing-tuned-link: pass:macros[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/monitoring_and_managing_system_status_and_performance/getting-started-with-tuned_monitoring-and-managing-system-status-and-performance#installing-and-enabling-tuned_getting-started-with-tuned] endif::[] -* The `tuned` service is installed and enabled. -+ -For details, see {installing-tuned-link}. +* The `tuned` service is installed and enabled. For details, see {installing-tuned-link}. .Procedure -// Use an xref if we're inside the performance title or the upstream TuneD manual. +// Use an xref if we're inside the performance title or the upstream Tuned manual. Wrap performance title inside pantheonenv[] ifndef. Use pantheonenv[] ifdef to use correct xref syntax for PV2. +ifndef::pantheonenv[] ifdef::performance-title[] -:tuned-profiles-link: pass:macros[xref:tuned-profiles-distributed-with-rhel_getting-started-with-tuned[]] +:tuned-profiles-link: pass:macros[xref:tuned-profiles-distributed-with-rhel_getting-started-with-tuned[Tuned profiles distributed with RHEL]] +endif::[] +endif::[] +ifdef::pantheonenv[] +:tuned-profiles-link: pass:macros[xref:modules/performance/ref_tuned-profiles-distributed-with-rhel.adoc[Tuned profiles distributed with RHEL]] endif::[] ifdef::upstream[] :tuned-profiles-link: pass:macros[xref:tuned-profiles-distributed-with-rhel_getting-started-with-tuned[]] @@ -57,39 +67,51 @@ $ tuned-adm active # mkdir /etc/tuned/[replaceable]__my-profile__ ---- -. Find the World Wide Name (WWN) identifier of the selected block device: +. Find the system unique identifier of the selected block device: + [subs=+quotes] ---- -$ udevadm info --query=property --name=/dev/[replaceable]__device__ | grep WWN= +$ udevadm info --query=property --name=/dev/_device_ | grep -E '(WWN|SERIAL)' -ID_WWN=[replaceable]__0x5002538d00000000__ +ID_WWN=_0x5002538d00000000__ +ID_SERIAL=_Generic-_SD_MMC_20120501030900000-0:0_ +ID_SERIAL_SHORT=_20120501030900000_ ---- ++ +[NOTE] +==== +The command in the this example will return all values identified as a World Wide Name (WWN) or serial number associated with the specified block device. Although it is preferred to use a WWN, the WWN is not always available for a given device and any values returned by the example command are acceptable to use as the _device system unique ID_. +==== -. Create the [filename]`/etc/tuned/[replaceable]__my-profile__/tuned.conf` configuration file. In the file, set the following options: +. Create the `/etc/tuned/_my-profile_/tuned.conf` configuration file. In the file, set the following options: -** Optional: Include an existing profile: +.. Optional: Include an existing profile: + [subs=+quotes] ---- [main] -include=[replaceable]__existing-profile__ +include=_existing-profile_ ---- -** Set the selected disk scheduler for the device that matches the WWN identifier: +.. Set the selected disk scheduler for the device that matches the WWN identifier: + [subs=+quotes] ---- [disk] -devices_udev_regex=ID_WWN=[replaceable]__0x5002538d00000000__ -elevator=[replaceable]__selected-scheduler__ +devices_udev_regex=_IDNAME_=_device system unique id_ +elevator=_selected-scheduler_ ---- + -To match multiple devices in the [option]`devices_udev_regex` option, enclose the identifiers in parentheses and separate them with vertical bars: +Here: + +* Replace _IDNAME_ with the name of the identifier being used (for example, `ID_WWN`). +* Replace _device system unique id_ with the value of the chosen identifier (for example, `0x5002538d00000000`). ++ +To match multiple devices in the `devices_udev_regex` option, enclose the identifiers in parentheses and separate them with vertical bars: + [subs=+quotes] ---- -devices_udev_regex=(ID_WWN=[replaceable]__0x5002538d00000000__)|(ID_WWN=[replaceable]__0x1234567800000000__) +devices_udev_regex=(ID_WWN=_0x5002538d00000000_)|(ID_WWN=_0x1234567800000000_) ---- . Enable your profile: @@ -99,6 +121,8 @@ devices_udev_regex=(ID_WWN=[replaceable]__0x5002538d00000000__)|(ID_WWN=[replace # tuned-adm profile [replaceable]__my-profile__ ---- +.Verification steps + . Verify that the TuneD profile is active and applied: + [subs=+quotes] @@ -116,20 +140,23 @@ See TuneD log file ('/var/log/tuned/tuned.log') for details. ---- +[role="_additional-resources"] .Additional resources - -// Use an xref if we're inside the performance title or the upstream TuneD manual. +// Use an xref if we're inside the performance title or the upstream Tuned manual. Wrap performance title inside pantheonenv[] ifndef. Use pantheonenv[] ifdef to use correct xref syntax for PV2. +ifndef::pantheonenv[] ifdef::performance-title[] -:customizing-tuned-link: pass:macros[xref:customizing-tuned-profiles_monitoring-and-managing-system-status-and-performance[]] +:customizing-tuned-link: pass:macros[xref:customizing-tuned-profiles_monitoring-and-managing-system-status-and-performance[Customizing Tuned profiles]] +endif::[] +endif::[] +ifdef::pantheonenv[] +:customizing-tuned-link: pass:macros[xref:assemblies/assembly_customizing-tuned-profiles.adoc[Customizing Tuned Profiles]] endif::[] ifdef::upstream[] -:customizing-tuned-link: pass:macros[xref:customizing-tuned-profiles_tuned-documentation[]] +:customizing-tuned-link: pass:macros[xref:customizing-tuned-profiles_monitoring-and-managing-system-status-and-performance[Customizing Tuned profiles]] endif::[] - // Use a link elsewhere. ifndef::performance-title[] :customizing-tuned-link: pass:macros[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/monitoring_and_managing_system_status_and_performance/customizing-tuned-profiles_monitoring-and-managing-system-status-and-performance] endif::[] - -* For more information on creating a *TuneD* profile, see {customizing-tuned-link}. - +//* For more information on creating a *TuneD* profile, see +* {customizing-tuned-link}. diff --git a/doc/manual/modules/performance/ref_available-tuned-plug-ins.adoc b/doc/manual/modules/performance/ref_available-tuned-plug-ins.adoc index 97a91cc..22def92 100644 --- a/doc/manual/modules/performance/ref_available-tuned-plug-ins.adoc +++ b/doc/manual/modules/performance/ref_available-tuned-plug-ins.adoc @@ -1,6 +1,8 @@ +:_module-type: REFERENCE [id="available-tuned-plug-ins_{context}"] = Available TuneD plug-ins +[role="_abstract"] This section lists all monitoring and tuning plug-ins currently available in *TuneD*. [discrete] @@ -9,13 +11,13 @@ This section lists all monitoring and tuning plug-ins currently available in *Tu Currently, the following monitoring plug-ins are implemented: `disk`:: -Gets disk load (number of IO operations) per device and measurement interval. +Gets disk load (number of IO operations) per device and measurement interval. `net`:: -Gets network load (number of transferred packets) per network card and measurement interval. +Gets network load (number of transferred packets) per network card and measurement interval. `load`:: -Gets CPU load per CPU and measurement interval. +Gets CPU load per CPU and measurement interval. [discrete] == Tuning plug-ins @@ -27,19 +29,19 @@ Sets the CPU governor to the value specified by the [option]`governor` option an + If the CPU load is lower than the value specified by the [option]`load_threshold` option, the latency is set to the value specified by the [option]`latency_high` option, otherwise it is set to the value specified by [option]`latency_low`. + -You can also force the latency to a specific value and prevent it from dynamically changing further. To do so, set the [option]`force_latency` option to the required latency value. +You can also force the latency to a specific value and prevent it from dynamically changing further. To do so, set the [option]`force_latency` option to the required latency value. `eeepc_she`:: -Dynamically sets the front-side bus (FSB) speed according to the CPU load. +Dynamically sets the front-side bus (FSB) speed according to the CPU load. + This feature can be found on some netbooks and is also known as the ASUS Super Hybrid Engine (SHE). + -If the CPU load is lower or equal to the value specified by the [option]`load_threshold_powersave` option, the plug-in sets the FSB speed to the value specified by the [option]`she_powersave` option. If the CPU load is higher or equal to the value specified by the [option]`load_threshold_normal` option, it sets the FSB speed to the value specified by the [option]`she_normal` option. +If the CPU load is lower or equal to the value specified by the [option]`load_threshold_powersave` option, the plug-in sets the FSB speed to the value specified by the [option]`she_powersave` option. If the CPU load is higher or equal to the value specified by the [option]`load_threshold_normal` option, it sets the FSB speed to the value specified by the [option]`she_normal` option. + -Static tuning is not supported and the plug-in is transparently disabled if *TuneD* does not detect the hardware support for this feature. +Static tuning is not supported and the plug-in is transparently disabled if *TuneD* does not detect the hardware support for this feature. `net`:: -Configures the Wake-on-LAN functionality to the values specified by the [option]`wake_on_lan` option. It uses the same syntax as the `ethtool` utility. It also dynamically changes the interface speed according to the interface utilization. +Configures the Wake-on-LAN functionality to the values specified by the [option]`wake_on_lan` option. It uses the same syntax as the `ethtool` utility. It also dynamically changes the interface speed according to the interface utilization. `sysctl`:: Sets various `sysctl` settings specified by the plug-in options. @@ -49,17 +51,25 @@ The syntax is ``[replaceable]__name__=[replaceable]__value__``, where [replaceab Use the `sysctl` plug-in if you need to change system settings that are not covered by other plug-ins available in *TuneD*. If the settings are covered by some specific plug-ins, prefer these plug-ins. `usb`:: -Sets autosuspend timeout of USB devices to the value specified by the [option]`autosuspend` parameter. +Sets autosuspend timeout of USB devices to the value specified by the [option]`autosuspend` parameter. + -The value `0` means that autosuspend is disabled. +The value `0` means that autosuspend is disabled. `vm`:: Enables or disables transparent huge pages depending on the Boolean value of the [option]`transparent_hugepages` option. ++ +Valid values of the [option]`transparent_hugepages` option are: ++ +-- +* "always" +* "never" +* "madvise" +-- `audio`:: Sets the autosuspend timeout for audio codecs to the value specified by the [option]`timeout` option. + -Currently, the `snd_hda_intel` and `snd_ac97_codec` codecs are supported. The value `0` means that the autosuspend is disabled. You can also enforce the controller reset by setting the Boolean option [option]`reset_controller` to `true`. +Currently, the `snd_hda_intel` and `snd_ac97_codec` codecs are supported. The value `0` means that the autosuspend is disabled. You can also enforce the controller reset by setting the Boolean option [option]`reset_controller` to `true`. `disk`:: Sets the disk elevator to the value specified by the [option]`elevator` option. @@ -74,7 +84,7 @@ It also sets: * The current disk readahead to a value multiplied by the constant specified by the [option]`readahead_multiply` option -- + -In addition, this plug-in dynamically changes the advanced power management and spindown timeout setting for the drive according to the current drive utilization. The dynamic tuning can be controlled by the Boolean option [option]`dynamic` and is enabled by default. +In addition, this plug-in dynamically changes the advanced power management and spindown timeout setting for the drive according to the current drive utilization. The dynamic tuning can be controlled by the Boolean option [option]`dynamic` and is enabled by default. `scsi_host`:: Tunes options for SCSI hosts. @@ -82,7 +92,7 @@ Tunes options for SCSI hosts. It sets Aggressive Link Power Management (ALPM) to the value specified by the [option]`alpm` option. `mounts`:: -Enables or disables barriers for mounts according to the Boolean value of the [option]`disable_barriers` option. +Enables or disables barriers for mounts according to the Boolean value of the [option]`disable_barriers` option. `scheduler`:: Allows tuning of scheduling priorities, processes/threads/IRQs affinities, and CPU cores isolation. @@ -119,7 +129,7 @@ The cpulist is unpacked and written directly to `/proc/irq/default_smp_affinity` `script`:: Executes an external script or binary when the profile is loaded or unloaded. You can choose an arbitrary executable. + -IMPORTANT: The `script` plug-in is provided mainly for compatibility with earlier releases. Prefer other *TuneD* plug-ins if they cover the required functionality. +IMPORTANT: The `script` plug-in is provided mainly for compatibility with earlier releases. Prefer other *TuneD* plug-ins if they cover the required functionality. + *TuneD* calls the executable with one of the following arguments: + @@ -128,7 +138,7 @@ IMPORTANT: The `script` plug-in is provided mainly for compatibility with earlie ** `stop` when unloading the profile -- + -You need to correctly implement the `stop` action in your executable and revert all settings that you changed during the `start` action. Otherwise, the roll-back step after changing your *TuneD* profile will not work. +You need to correctly implement the `stop` action in your executable and revert all settings that you changed during the `start` action. Otherwise, the roll-back step after changing your *TuneD* profile will not work. + Bash scripts can import the [filename]`/usr/lib/tuned/functions` Bash library and use the functions defined there. Use these functions only for functionality that is not natively provided by *TuneD*. If a function name starts with an underscore, such as `_wifi_set_power_level`, consider the function private and do not use it in your scripts, because it might change in the future. + @@ -147,14 +157,14 @@ script=${i:PROFILE_DIR}/script.sh `sysfs`:: Sets various `sysfs` settings specified by the plug-in options. + -The syntax is ``[replaceable]__name__=[replaceable]__value__``, where [replaceable]_name_ is the `sysfs` path to use. +The syntax is ``[replaceable]__name__=[replaceable]__value__``, where [replaceable]_name_ is the `sysfs` path to use. + Use this plugin in case you need to change some settings that are not covered by other plug-ins. Prefer specific plug-ins if they cover the required settings. `video`:: Sets various powersave levels on video cards. Currently, only the Radeon cards are supported. + -The powersave level can be specified by using the [option]`radeon_powersave` option. Supported values are: +The powersave level can be specified by using the [option]`radeon_powersave` option. Supported values are: + -- * `default` @@ -168,7 +178,7 @@ The powersave level can be specified by using the [option]`radeon_powersave` opt * `dpm-perfomance` -- + -For details, see link:http://www.x.org/wiki/RadeonFeature#KMS_Power_Management_Options[www.x.org]. Note that this plug-in is experimental and the option might change in future releases. +For details, see link:http://www.x.org/wiki/RadeonFeature#KMS_Power_Management_Options[www.x.org]. Note that this plug-in is experimental and the option might change in future releases. `bootloader`:: Adds options to the kernel command line. This plug-in supports only the GRUB 2 boot loader. @@ -205,4 +215,3 @@ cmdline=isolcpus=2 ==== -- - diff --git a/doc/manual/modules/performance/ref_built-in-functions-available-in-tuned-profiles.adoc b/doc/manual/modules/performance/ref_built-in-functions-available-in-tuned-profiles.adoc index 6e9927a..f079ba5 100644 --- a/doc/manual/modules/performance/ref_built-in-functions-available-in-tuned-profiles.adoc +++ b/doc/manual/modules/performance/ref_built-in-functions-available-in-tuned-profiles.adoc @@ -1,6 +1,8 @@ +:_module-type: REFERENCE [id="built-in-functions-available-in-tuned-profiles_{context}"] = Built-in functions available in TuneD profiles +[role="_abstract"] The following built-in functions are available in all *TuneD* profiles: `PROFILE_DIR`:: @@ -53,4 +55,3 @@ Unpacks a CPU list in the form of `1-3,4` to `1,2,3,4`. `cpulist_pack`:: Packs a CPU list in the form of `1,2,3,5` to `1-3,5`. - diff --git a/doc/manual/modules/performance/ref_real-time-tuned-profiles-distributed-with-rhel.adoc b/doc/manual/modules/performance/ref_real-time-tuned-profiles-distributed-with-rhel.adoc new file mode 100644 index 0000000..4be3f93 --- /dev/null +++ b/doc/manual/modules/performance/ref_real-time-tuned-profiles-distributed-with-rhel.adoc @@ -0,0 +1,23 @@ +:_module-type: REFERENCE +[id="real-time-tuned-profiles-distributed-with-rhel_{context}"] += Real-time TuneD profiles distributed with RHEL + +[role="_abstract"] +Real-time profiles are intended for systems running the real-time kernel. Without a special kernel build, they do not configure the system to be real-time. On RHEL, the profiles are available from additional repositories. + +The following real-time profiles are available: + +`realtime`:: +Use on bare-metal real-time systems. ++ +Provided by the [package]`tuned-profiles-realtime` package, which is available from the RT or NFV repositories. + +`realtime-virtual-host`:: +Use in a virtualization host configured for real-time. ++ +Provided by the [package]`tuned-profiles-nfv-host` package, which is available from the NFV repository. + +`realtime-virtual-guest`:: +Use in a virtualization guest configured for real-time. ++ +Provided by the [package]`tuned-profiles-nfv-guest` package, which is available from the NFV repository. diff --git a/doc/manual/modules/performance/ref_tuned-profiles-distributed-with-rhel.adoc b/doc/manual/modules/performance/ref_tuned-profiles-distributed-with-rhel.adoc index a0f6f19..071c90a 100644 --- a/doc/manual/modules/performance/ref_tuned-profiles-distributed-with-rhel.adoc +++ b/doc/manual/modules/performance/ref_tuned-profiles-distributed-with-rhel.adoc @@ -1,6 +1,8 @@ +:_module-type: CONCEPT [id="tuned-profiles-distributed-with-rhel_{context}"] = TuneD profiles distributed with RHEL +[role="_abstract"] The following is a list of profiles that are installed with *TuneD* on {RHEL}. NOTE: There might be more product-specific or third-party *TuneD* profiles available. Such profiles are usually provided by separate RPM packages. @@ -8,10 +10,14 @@ NOTE: There might be more product-specific or third-party *TuneD* profiles avail `balanced`:: The default power-saving profile. It is intended to be a compromise between performance and power consumption. It uses auto-scaling and auto-tuning whenever possible. The only drawback is the increased latency. In the current *TuneD* release, it enables the CPU, disk, audio, and video plugins, and activates the `conservative` CPU governor. The `radeon_powersave` option uses the `dpm-balanced` value if it is supported, otherwise it is set to `auto`. ++ +It changes the `energy_performance_preference` attribute to the `normal` energy setting. It also changes the `scaling_governor` policy attribute to either the `conservative` or `powersave` CPU governor. `powersave`:: A profile for maximum power saving performance. It can throttle the performance in order to minimize the actual power consumption. In the current *TuneD* release it enables USB autosuspend, WiFi power saving, and Aggressive Link Power Management (ALPM) power savings for SATA host adapters. It also schedules multi-core power savings for systems with a low wakeup rate and activates the `ondemand` governor. It enables AC97 audio power saving or, depending on your system, HDA-Intel power savings with a 10 seconds timeout. If your system contains a supported Radeon graphics card with enabled KMS, the profile configures it to automatic power saving. On ASUS Eee PCs, a dynamic Super Hybrid Engine is enabled. + +It changes the `energy_performance_preference` attribute to the `powersave` or `power` energy setting. It also changes the `scaling_governor` policy attribute to either the `ondemand` or `powersave` CPU governor. ++ [NOTE] -- In certain cases, the `balanced` profile is more efficient compared to the `powersave` profile. @@ -23,6 +29,8 @@ That is why the `balanced` profile can be generally a better option. `throughput-performance`:: A server profile optimized for high throughput. It disables power savings mechanisms and enables `sysctl` settings that improve the throughput performance of the disk and network IO. CPU governor is set to `performance`. ++ +It changes the `energy_performance_preference` and `scaling_governor` attribute to the `performance` profile. `accelerator-performance`:: The `accelerator-performance` profile contains the same tuning as the `throughput-performance` profile. Additionally, it locks the CPU to low C states so that the latency is less than 100us. This improves the performance of certain accelerators, such as GPUs. @@ -100,25 +108,3 @@ A profile optimized for systems with user-defined Intel Speed Select Technology ---- # tuned-adm profile cpu-partitioning intel-sst ---- - -[discrete] -== Real-time profiles - -Real-time profiles are intended for systems running the real-time kernel. Without a special kernel build, they do not configure the system to be real-time. On RHEL, the profiles are available from additional repositories. - -The following real-time profiles are available: - -`realtime`:: -Use on bare-metal real-time systems. -+ -Provided by the [package]`tuned-profiles-realtime` package, which is available from the RT or NFV repositories. - -`realtime-virtual-host`:: -Use in a virtualization host configured for real-time. -+ -Provided by the [package]`tuned-profiles-nfv-host` package, which is available from the NFV repository. - -`realtime-virtual-guest`:: -Use in a virtualization guest configured for real-time. -+ -Provided by the [package]`tuned-profiles-nfv-guest` package, which is available from the NFV repository. diff --git a/profiles/cpu-partitioning/script.sh b/profiles/cpu-partitioning/script.sh index 8677050..84e04fd 100755 --- a/profiles/cpu-partitioning/script.sh +++ b/profiles/cpu-partitioning/script.sh @@ -2,38 +2,6 @@ . /usr/lib/tuned/functions -no_balance_cpus_file=$STORAGE/no-balance-cpus.txt - -change_sd_balance_bit() -{ - local set_bit=$1 - local flags_cur= - local file= - local cpu= - - for cpu in $(cat $no_balance_cpus_file); do - for file in $(find /proc/sys/kernel/sched_domain/cpu$cpu -name flags -print); do - flags_cur=$(cat $file) - if [ $set_bit -eq 1 ]; then - flags_cur=$((flags_cur | 0x1)) - else - flags_cur=$((flags_cur & 0xfffe)) - fi - echo $flags_cur > $file - done - done -} - -disable_balance_domains() -{ - change_sd_balance_bit 0 -} - -enable_balance_domains() -{ - change_sd_balance_bit 1 -} - start() { mkdir -p "${TUNED_tmpdir}/etc/systemd" mkdir -p "${TUNED_tmpdir}/usr/lib/dracut/hooks/pre-udev" @@ -41,9 +9,6 @@ start() { cp 00-tuned-pre-udev.sh "${TUNED_tmpdir}/usr/lib/dracut/hooks/pre-udev/" setup_kvm_mod_low_latency disable_ksm - - echo "$TUNED_no_balance_cores_expanded" | sed 's/,/ /g' > $no_balance_cpus_file - disable_balance_domains return "$?" } @@ -53,7 +18,6 @@ stop() { teardown_kvm_mod_low_latency enable_ksm fi - enable_balance_domains return "$?" } diff --git a/profiles/cpu-partitioning/tuned.conf b/profiles/cpu-partitioning/tuned.conf index 842e2bd..979e40b 100644 --- a/profiles/cpu-partitioning/tuned.conf +++ b/profiles/cpu-partitioning/tuned.conf @@ -35,6 +35,8 @@ no_balance_cores_expanded=${f:cpulist_unpack:${no_balance_cores}} # Fail if isolated_cores contains CPUs which are not online assert2=${f:assertion:isolated_cores contains online CPU(s):${isolated_cores_expanded}:${isolated_cores_online_expanded}} +cmd_isolcpus=${f:regex_search_ternary:${no_balance_cores}:\s*[0-9]: isolcpus=${no_balance_cores}:} + [sysctl] kernel.hung_task_timeout_secs = 600 kernel.nmi_watchdog = 0 @@ -66,4 +68,4 @@ priority=10 initrd_remove_dir=True initrd_dst_img=tuned-initrd.img initrd_add_dir=${tmpdir} -cmdline_cpu_part=+nohz=on nohz_full=${isolated_cores} rcu_nocbs=${isolated_cores} tuned.non_isolcpus=${not_isolated_cpumask} intel_pstate=disable nosoftlockup +cmdline_cpu_part=+nohz=on${cmd_isolcpus} nohz_full=${isolated_cores} rcu_nocbs=${isolated_cores} tuned.non_isolcpus=${not_isolated_cpumask} intel_pstate=disable nosoftlockup diff --git a/profiles/functions b/profiles/functions index 3168e71..4abeab5 100644 --- a/profiles/functions +++ b/profiles/functions @@ -565,6 +565,8 @@ disable_ksm() if ! touch $KSM_MASK_FILE; then die "failed to create $KSM_MASK_FILE" fi + # Do not run any systemctl commands if $KSM_SERVICES units do not exist + systemctl cat -- $KSM_SERVICES &> /dev/null || return systemctl --now --quiet mask $KSM_SERVICES # Unmerge all shared pages test -f $KSM_RUN_PATH && echo 2 > $KSM_RUN_PATH @@ -575,6 +577,8 @@ disable_ksm() enable_ksm() { if [ -f $KSM_MASK_FILE ]; then + # Do not run any systemctl commands if $KSM_SERVICES units do not exist + systemctl cat -- $KSM_SERVICES &> /dev/null || return if systemctl --quiet unmask $KSM_SERVICES; then rm -f $KSM_MASK_FILE fi diff --git a/profiles/latency-performance/tuned.conf b/profiles/latency-performance/tuned.conf index da1e357..d200b5c 100644 --- a/profiles/latency-performance/tuned.conf +++ b/profiles/latency-performance/tuned.conf @@ -6,7 +6,7 @@ summary=Optimize for deterministic performance at the cost of increased power consumption [cpu] -force_latency=cstate.id:1|3 +force_latency=cstate.id_no_zero:1|3 governor=performance energy_perf_bias=performance min_perf_pct=100 diff --git a/profiles/openshift/tuned.conf b/profiles/openshift/tuned.conf index af2f2bc..9019c05 100644 --- a/profiles/openshift/tuned.conf +++ b/profiles/openshift/tuned.conf @@ -28,3 +28,5 @@ vm.max_map_count=262144 [scheduler] # see rhbz#1979352; exclude containers from aligning to house keeping CPUs cgroup_ps_blacklist=/kubepods\.slice/ +# workaround for rhbz#1921738 +runtime=0 diff --git a/profiles/sap-hana/tuned.conf b/profiles/sap-hana/tuned.conf index 81d5930..aeecf53 100644 --- a/profiles/sap-hana/tuned.conf +++ b/profiles/sap-hana/tuned.conf @@ -6,7 +6,7 @@ summary=Optimize for SAP HANA [cpu] -force_latency=cstate.id:3|70 +force_latency=cstate.id_no_zero:3|70 governor=performance energy_perf_bias=performance min_perf_pct=100 diff --git a/profiles/virtual-host/tuned.conf b/profiles/virtual-host/tuned.conf index c1942da..5301d9f 100644 --- a/profiles/virtual-host/tuned.conf +++ b/profiles/virtual-host/tuned.conf @@ -13,4 +13,4 @@ vm.dirty_background_ratio = 5 [cpu] # Setting C3 state sleep mode/power savings -force_latency=cstate.id:3|70 +force_latency=cstate.id_no_zero:3|70 diff --git a/tests/beakerlib/Program-tuned-tried-to-access-dev-mem-between/runtest.sh b/tests/beakerlib/Program-tuned-tried-to-access-dev-mem-between/runtest.sh index 1f47683..c80eff9 100755 --- a/tests/beakerlib/Program-tuned-tried-to-access-dev-mem-between/runtest.sh +++ b/tests/beakerlib/Program-tuned-tried-to-access-dev-mem-between/runtest.sh @@ -8,20 +8,9 @@ # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Copyright (c) 2019 Red Hat, Inc. +# Copyright Red Hat # -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. +# SPDX-License-Identifier: GPL-2.0-or-later WITH GPL-CC-1.0 # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/beakerlib/Tuned-takes-too-long-to-reload-start-when-ulimit/runtest.sh b/tests/beakerlib/Tuned-takes-too-long-to-reload-start-when-ulimit/runtest.sh index 93e41e8..906bf87 100755 --- a/tests/beakerlib/Tuned-takes-too-long-to-reload-start-when-ulimit/runtest.sh +++ b/tests/beakerlib/Tuned-takes-too-long-to-reload-start-when-ulimit/runtest.sh @@ -8,20 +8,9 @@ # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Copyright (c) 2019 Red Hat, Inc. +# Copyright Red Hat # -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. +# SPDX-License-Identifier: GPL-2.0-or-later WITH GPL-CC-1.0 # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/runtest.sh b/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/runtest.sh index b8eda30..2e7d8d7 100755 --- a/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/runtest.sh +++ b/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/runtest.sh @@ -8,20 +8,9 @@ # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Copyright (c) 2020 Red Hat, Inc. +# Copyright Red Hat # -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. +# SPDX-License-Identifier: GPL-2.0-or-later WITH GPL-CC-1.0 # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/beakerlib/error-messages/runtest.sh b/tests/beakerlib/error-messages/runtest.sh index 3245525..752c949 100755 --- a/tests/beakerlib/error-messages/runtest.sh +++ b/tests/beakerlib/error-messages/runtest.sh @@ -8,20 +8,9 @@ # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Copyright (c) 2017 Red Hat, Inc. +# Copyright Red Hat # -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. +# SPDX-License-Identifier: GPL-2.0-or-later WITH GPL-CC-1.0 # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/beakerlib/tuned-adm-functionality/runtest.sh b/tests/beakerlib/tuned-adm-functionality/runtest.sh index 32e1e88..922fd5b 100755 --- a/tests/beakerlib/tuned-adm-functionality/runtest.sh +++ b/tests/beakerlib/tuned-adm-functionality/runtest.sh @@ -8,21 +8,9 @@ # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Copyright (c) 2012 Red Hat, Inc. All rights reserved. +# Copyright Red Hat # -# This copyrighted material is made available to anyone wishing -# to use, modify, copy, or redistribute it subject to the terms -# and conditions of the GNU General Public License version 2. -# -# This program is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program; if not, write to the Free -# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# SPDX-License-Identifier: GPL-2.0-or-later WITH GPL-CC-1.0 # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/beakerlib/variables-support-in-profiles/main.fmf b/tests/beakerlib/variables-support-in-profiles/main.fmf new file mode 100644 index 0000000..92c9f24 --- /dev/null +++ b/tests/beakerlib/variables-support-in-profiles/main.fmf @@ -0,0 +1,30 @@ +summary: variables support in profiles +description: '' +contact: rhack@redhat.com +component: + - tuned +test: ./runtest.sh +framework: beakerlib +require: + - library(tuned/basic) +recommend: + - tuned +duration: 5m +enabled: true +tag: + - FedoraReady + - NoRHEL4 + - NoRHEL5 + - TIPfail_infra + - TIPpass + - Tier1 +tier: '1' +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1225124 +adjust: + - enabled: false + when: distro < rhel-7 + continue: false +extra-nitrate: TC#0496575 +extra-summary: /CoreOS/tuned/Sanity/variables-support-in-profiles +extra-task: /CoreOS/tuned/Sanity/variables-support-in-profiles diff --git a/tests/beakerlib/variables-support-in-profiles/runtest.sh b/tests/beakerlib/variables-support-in-profiles/runtest.sh new file mode 100755 index 0000000..b8423bb --- /dev/null +++ b/tests/beakerlib/variables-support-in-profiles/runtest.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/tuned/Sanity/variables-support-in-profiles +# Description: variables support in profiles +# Author: Branislav Blaskovic +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright Red Hat +# +# SPDX-License-Identifier: GPL-2.0-or-later WITH GPL-CC-1.0 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="tuned" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlImport "tuned/basic" + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + sleep 2 + rlServiceStart "tuned" + sleep 2 + tunedProfileBackup + rlFileBackup "/usr/lib/tuned/balanced/tuned.conf" + + echo " +[variables] +SWAPPINESS1 = 70 +SWAPPINESS2 = \${SWAPPINESS1} + +[sysctl] +vm.swappiness = \${SWAPPINESS2} +" >> /usr/lib/tuned/balanced/tuned.conf + + rlRun "cat /usr/lib/tuned/balanced/tuned.conf" + + OLD_SWAPPINESS=$(sysctl -n vm.swappiness) + + rlPhaseEnd + + rlPhaseStartTest + rlRun "tuned-adm profile balanced" + rlRun -s "sysctl -n vm.swappiness" + rlAssertGrep "70" "$rlRun_LOG" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "sysctl vm.swappiness=$OLD_SWAPPINESS" + rlFileRestore + tunedProfileRestore + sleep 2 + rlServiceRestore "tuned" + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tuned.spec b/tuned.spec index 6032a04..42c8fde 100644 --- a/tuned.spec +++ b/tuned.spec @@ -44,7 +44,7 @@ Summary: A dynamic adaptive system tuning daemon Name: tuned -Version: 2.16.0 +Version: 2.17.0 Release: 1%{?prerel1}%{?with_snapshot:.%{git_suffix}}%{?dist} License: GPLv2+ Source0: https://github.com/redhat-performance/%{name}/archive/v%{version}%{?prerel2}/%{name}-%{version}%{?prerel2}.tar.gz @@ -92,10 +92,14 @@ Recommends: dmidecode Recommends: hdparm Recommends: kernel-tools Recommends: kmod +Recommends: iproute %endif # syspurpose %if 0%{?rhel} > 8 +# not on CentOS +%if 0%{!?centos:1} Recommends: subscription-manager +%endif %else %if 0%{?rhel} > 7 Requires: python3-syspurpose @@ -261,7 +265,7 @@ Requires: %{name} = %{version} Additional TuneD profile(s) optimized for OpenShift. %prep -%setup -q -n %{name}-%{version}%{?prerel2} +%autosetup -p1 -n %{name}-%{version}%{?prerel2} %build # Docs cannot be generated on RHEL now due to missing asciidoctor dependency @@ -384,7 +388,6 @@ fi %files -%defattr(-,root,root,-) %exclude %{docdir}/README.utils %exclude %{docdir}/README.scomes %exclude %{docdir}/README.NFV @@ -452,7 +455,6 @@ fi %{_prefix}/lib/kernel/install.d/92-tuned.install %files gtk -%defattr(-,root,root,-) %{_sbindir}/tuned-gui %if %{with python3} %{python3_sitelib}/tuned/gtk @@ -469,7 +471,6 @@ fi %{_libexecdir}/tuned/pmqos-static* %files utils-systemtap -%defattr(-,root,root,-) %doc doc/README.utils %doc doc/README.scomes %doc COPYING @@ -483,66 +484,54 @@ fi %{_mandir}/man8/scomes.* %files profiles-sap -%defattr(-,root,root,-) %{_prefix}/lib/tuned/sap-netweaver %{_mandir}/man7/tuned-profiles-sap.7* %files profiles-sap-hana -%defattr(-,root,root,-) %{_prefix}/lib/tuned/sap-hana %{_mandir}/man7/tuned-profiles-sap-hana.7* %files profiles-mssql -%defattr(-,root,root,-) %{_prefix}/lib/tuned/mssql %{_mandir}/man7/tuned-profiles-mssql.7* %files profiles-oracle -%defattr(-,root,root,-) %{_prefix}/lib/tuned/oracle %{_mandir}/man7/tuned-profiles-oracle.7* %files profiles-atomic -%defattr(-,root,root,-) %{_prefix}/lib/tuned/atomic-host %{_prefix}/lib/tuned/atomic-guest %{_mandir}/man7/tuned-profiles-atomic.7* %files profiles-realtime -%defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/tuned/realtime-variables.conf %{_prefix}/lib/tuned/realtime %{_mandir}/man7/tuned-profiles-realtime.7* %files profiles-nfv-guest -%defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/tuned/realtime-virtual-guest-variables.conf %{_prefix}/lib/tuned/realtime-virtual-guest %{_mandir}/man7/tuned-profiles-nfv-guest.7* %files profiles-nfv-host -%defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/tuned/realtime-virtual-host-variables.conf %{_prefix}/lib/tuned/realtime-virtual-host %{_mandir}/man7/tuned-profiles-nfv-host.7* %files profiles-nfv -%defattr(-,root,root,-) %doc %{docdir}/README.NFV %files profiles-cpu-partitioning -%defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/tuned/cpu-partitioning-variables.conf %{_prefix}/lib/tuned/cpu-partitioning %{_mandir}/man7/tuned-profiles-cpu-partitioning.7* %files profiles-spectrumscale -%defattr(-,root,root,-) %{_prefix}/lib/tuned/spectrumscale-ece %{_mandir}/man7/tuned-profiles-spectrumscale-ece.7* %files profiles-compat -%defattr(-,root,root,-) %{_prefix}/lib/tuned/default %{_prefix}/lib/tuned/desktop-powersave %{_prefix}/lib/tuned/laptop-ac-powersave @@ -553,18 +542,34 @@ fi %{_mandir}/man7/tuned-profiles-compat.7* %files profiles-postgresql -%defattr(-,root,root,-) %{_prefix}/lib/tuned/postgresql %{_mandir}/man7/tuned-profiles-postgresql.7* %files profiles-openshift -%defattr(-,root,root,-) %{_prefix}/lib/tuned/openshift %{_prefix}/lib/tuned/openshift-control-plane %{_prefix}/lib/tuned/openshift-node %{_mandir}/man7/tuned-profiles-openshift.7* %changelog +* Sun Jan 16 2022 Jaroslav Škarvada - 2.17.0-1 +- new release + - rebased tuned to latest upstream + related: rhbz#2003838 + +* Sun Jan 2 2022 Jaroslav Škarvada - 2.17.0-0.1.rc1 +- new release + - rebased tuned to latest upstream + resolves: rhbz#2003838 + - cpu-partitioning: fixed no_balance_cores on newer kernels + resolves: rhbz#1874596 + - scheduler: allow exclude of processes from the specific cgroup(s) + resolves: rhbz#1980715 + - switched to the configparser from the configobj + resolves: rhbz#1936386 + - spec: do not require subscription-manager on CentOS + resolves: rhbz#2029405 + * Wed Jul 21 2021 Jaroslav Škarvada - 2.16.0-1 - new release - rebased tuned to latest upstream diff --git a/tuned/daemon/application.py b/tuned/daemon/application.py index 18d54ce..c436f61 100644 --- a/tuned/daemon/application.py +++ b/tuned/daemon/application.py @@ -1,6 +1,7 @@ from tuned import storage, units, monitors, plugins, profiles, exports, hardware from tuned.exceptions import TunedException import tuned.logs +import tuned.version from . import controller from . import daemon import signal @@ -17,6 +18,9 @@ __all__ = ["Application"] class Application(object): def __init__(self, profile_name = None, config = None): + # os.uname()[2] is for the python-2.7 compatibility, it's the release string + # like e.g. '5.15.13-100.fc34.x86_64' + log.info("TuneD: %s, kernel: %s" % (tuned.version.TUNED_VERSION_STR, os.uname()[2])) self._dbus_exporter = None storage_provider = storage.PickleProvider() diff --git a/tuned/daemon/daemon.py b/tuned/daemon/daemon.py index b472296..6d27b2e 100644 --- a/tuned/daemon/daemon.py +++ b/tuned/daemon/daemon.py @@ -184,7 +184,7 @@ class Daemon(object): if out[:8] == "stopping": return False retcode, out = self._cmd.execute(["systemctl", "list-jobs"], no_errors = [0]) - return re.search(r"\b(shutdown|reboot|halt|poweroff)\.target.*start", out) is None + return re.search(r"\b(shutdown|reboot|halt|poweroff)\.target.*start", out) is None and not retcode def _thread_code(self): if self._profile is None: diff --git a/tuned/exports/dbus_exporter.py b/tuned/exports/dbus_exporter.py index 63440c9..2034e1e 100644 --- a/tuned/exports/dbus_exporter.py +++ b/tuned/exports/dbus_exporter.py @@ -18,7 +18,7 @@ try: from inspect import getfullargspec def getargspec(func): - return getfullargspec(func).args + return getfullargspec(func) except ImportError: # Python2 version, drop after support stops from inspect import getargspec @@ -75,7 +75,7 @@ class DBusExporter(interfaces.ExporterInterface): def _prepare_for_dbus(self, method, wrapper): source = """def {name}({args}): return wrapper({args}) - """.format(name=method.__name__, args=', '.join(getargspec(method.__func__))) + """.format(name=method.__name__, args=', '.join(getargspec(method.__func__).args)) code = compile(source, '' % len(self._dbus_methods), 'exec') # https://docs.python.org/3.9/library/inspect.html # co_consts - tuple of constants used in the bytecode diff --git a/tuned/plugins/plugin_cpu.py b/tuned/plugins/plugin_cpu.py index 5432db7..8ab9dd3 100644 --- a/tuned/plugins/plugin_cpu.py +++ b/tuned/plugins/plugin_cpu.py @@ -242,16 +242,19 @@ class CPULatencyPlugin(base.Plugin): if latency is not None: self.cstates_latency[name.strip()] = latency - def _get_latency_by_cstate_name(self, name): + def _get_latency_by_cstate_name(self, name, no_zero=False): log.debug("getting latency for cstate with name '%s'" % name) if self.cstates_latency is None: log.debug("reading cstates latency table") self._read_cstates_latency() latency = self.cstates_latency.get(name, None) + if no_zero and latency == 0: + log.debug("skipping latency 0 as set by param") + return None log.debug("cstate name mapped to latency: %s" % str(latency)) return latency - def _get_latency_by_cstate_id(self, lid): + def _get_latency_by_cstate_id(self, lid, no_zero=False): log.debug("getting latency for cstate with ID '%s'" % str(lid)) lid = self._str2int(lid) if lid is None: @@ -259,6 +262,9 @@ class CPULatencyPlugin(base.Plugin): return None latency_path = cpuidle_states_path + "/%s/latency" % ("state%d" % lid) latency = self._str2int(self._cmd.read_file(latency_path, err_ret = None, no_error = True)) + if no_zero and latency == 0: + log.debug("skipping latency 0 as set by param") + return None log.debug("cstate ID mapped to latency: %s" % str(latency)) return latency @@ -272,8 +278,12 @@ class CPULatencyPlugin(base.Plugin): latency = int(latency) log.debug("parsed directly specified latency value: %d" % latency) except ValueError: - if latency[0:10] == "cstate.id:": + if latency[0:18] == "cstate.id_no_zero:": + latency = self._get_latency_by_cstate_id(latency[18:], no_zero=True) + elif latency[0:10] == "cstate.id:": latency = self._get_latency_by_cstate_id(latency[10:]) + elif latency[0:20] == "cstate.name_no_zero:": + latency = self._get_latency_by_cstate_name(latency[20:], no_zero=True) elif latency[0:12] == "cstate.name:": latency = self._get_latency_by_cstate_name(latency[12:]) elif latency in ["none", "None"]: diff --git a/tuned/plugins/plugin_disk.py b/tuned/plugins/plugin_disk.py index edb3121..4cb3623 100644 --- a/tuned/plugins/plugin_disk.py +++ b/tuned/plugins/plugin_disk.py @@ -27,22 +27,42 @@ class DiskPlugin(hotplug.Plugin): def _init_devices(self): super(DiskPlugin, self)._init_devices() self._devices_supported = True + self._use_hdparm = True self._free_devices = set() + self._hdparm_apm_devices = set() for device in self._hardware_inventory.get_devices("block"): if self._device_is_supported(device): self._free_devices.add(device.sys_name) + if self._use_hdparm and self._is_hdparm_apm_supported(device.sys_name): + self._hdparm_apm_devices.add(device.sys_name) self._assigned_devices = set() def _get_device_objects(self, devices): return [self._hardware_inventory.get_device("block", x) for x in devices] + def _is_hdparm_apm_supported(self, device): + (rc, out, err_msg) = self._cmd.execute(["hdparm", "-C", "/dev/%s" % device], \ + no_errors = [errno.ENOENT], return_err=True) + if rc == -errno.ENOENT: + log.warn("hdparm command not found, ignoring for other devices") + self._use_hdparm = False + return False + elif rc: + log.info("Device '%s' not supported by hdparm" % device) + log.debug("(rc: %s, msg: '%s')" % (rc, err_msg)) + return False + elif "unknown" in out: + log.info("Driver for device '%s' does not support apm command" % device) + return False + return True + @classmethod def _device_is_supported(cls, device): return device.device_type == "disk" and \ device.attributes.get("removable", None) == b"0" and \ (device.parent is None or \ - device.parent.subsystem in ["scsi", "virtio", "xen"]) + device.parent.subsystem in ["scsi", "virtio", "xen", "nvme"]) def _hardware_events_init(self): self._hardware_inventory.subscribe(self, "block", self._hardware_events_callback) @@ -142,6 +162,8 @@ class DiskPlugin(hotplug.Plugin): return not "standby" in out and not "sleeping" in out def _instance_update_dynamic(self, instance, device): + if not device in self._hdparm_apm_devices: + return load = instance._load_monitor.get_device_load(device) if load is None: return @@ -202,7 +224,7 @@ class DiskPlugin(hotplug.Plugin): diff = [new_old[0] - new_old[1] for new_old in zip(new_load, old_load)] instance._stats[device]["diff"] = diff - # adapt maximum expected load if the difference is higer + # adapt maximum expected load if the difference is higher old_max_load = instance._stats[device]["max"] max_load = [max(pair) for pair in zip(old_max_load, diff)] instance._stats[device]["max"] = max_load @@ -219,6 +241,15 @@ class DiskPlugin(hotplug.Plugin): else: instance._idle[device][operation] = 0 + def _instance_apply_dynamic(self, instance, device): + # At the moment we support dynamic tuning just for devices compatible with hdparm apm commands + # If in future will be added new functionality not connected to this command, + # it is needed to change it here + if device not in self._hdparm_apm_devices: + log.info("There is no dynamic tuning available for device '%s' at time" % device) + else: + super(DiskPlugin, self)._instance_apply_dynamic(*args, **kwargs) + def _instance_unapply_dynamic(self, instance, device): pass @@ -248,6 +279,12 @@ class DiskPlugin(hotplug.Plugin): @command_set("apm", per_device=True) def _set_apm(self, value, device, sim): + if device not in self._hdparm_apm_devices: + if not sim: + log.info("apm option is not supported for device '%s'" % device) + return None + else: + return str(value) if self._apm_errcnt < consts.ERROR_THRESHOLD: if not sim: (rc, out) = self._cmd.execute(["hdparm", "-B", str(value), "/dev/" + device], no_errors = [errno.ENOENT]) @@ -258,6 +295,10 @@ class DiskPlugin(hotplug.Plugin): @command_get("apm") def _get_apm(self, device, ignore_missing=False): + if device not in self._hdparm_apm_devices: + if not ignore_missing: + log.info("apm option is not supported for device '%s'" % device) + return None value = None err = False (rc, out) = self._cmd.execute(["hdparm", "-B", "/dev/" + device], no_errors = [errno.ENOENT]) @@ -278,6 +319,12 @@ class DiskPlugin(hotplug.Plugin): @command_set("spindown", per_device=True) def _set_spindown(self, value, device, sim): + if device not in self._hdparm_apm_devices: + if not sim: + log.info("spindown option is not supported for device '%s'" % device) + return None + else: + return str(value) if self._spindown_errcnt < consts.ERROR_THRESHOLD: if not sim: (rc, out) = self._cmd.execute(["hdparm", "-S", str(value), "/dev/" + device], no_errors = [errno.ENOENT]) @@ -288,6 +335,10 @@ class DiskPlugin(hotplug.Plugin): @command_get("spindown") def _get_spindown(self, device, ignore_missing=False): + if device not in self._hdparm_apm_devices: + if not ignore_missing: + log.info("spindown option is not supported for device '%s'" % device) + return None # There's no way how to get current/old spindown value, hardcoding vendor specific 253 return 253 @@ -361,6 +412,6 @@ class DiskPlugin(hotplug.Plugin): value = self._cmd.read_file(sys_file, no_error=ignore_missing).strip() if len(value) == 0: if not ignore_missing: - log.info("disk_scheduler_quantum option is not supported by this HW") + log.info("disk_scheduler_quantum option is not supported for device '%s'" % device) return None return int(value) diff --git a/tuned/plugins/plugin_net.py b/tuned/plugins/plugin_net.py index 51f2a8e..145f686 100644 --- a/tuned/plugins/plugin_net.py +++ b/tuned/plugins/plugin_net.py @@ -1,3 +1,4 @@ +import errno from . import base from .decorators import * import tuned.logs @@ -20,6 +21,8 @@ class NetTuningPlugin(base.Plugin): self._load_smallest = 0.05 self._level_steps = 6 self._cmd = commands() + self._re_ip_link_show_qlen = None + self._use_ip = True def _init_devices(self): self._devices_supported = True @@ -140,6 +143,7 @@ class NetTuningPlugin(base.Plugin): "pause": None, "ring": None, "channels": None, + "txqueuelen": None, } def _init_stats_and_idle(self, instance, device): @@ -283,6 +287,64 @@ class NetTuningPlugin(base.Plugin): return int(value) return None + def _call_ip_link(self, args=[]): + if not self._use_ip: + return None + args = ["ip", "link"] + args + (rc, out, err_msg) = self._cmd.execute(args, no_errors=[errno.ENOENT], return_err=True) + if rc == -errno.ENOENT: + log.warn("ip command not found, ignoring for other devices") + self._use_ip = False + return None + elif rc: + log.info("Problem calling ip command") + log.debug("(rc: %s, msg: '%s')" % (rc, err_msg)) + return None + return out + + def _ip_link_show(self, device=None): + args = ["show"] + if device: + args.append(device) + return self._call_ip_link(args) + + @command_set("txqueuelen", per_device=True) + def _set_txqueuelen(self, value, device, sim): + if value is None: + return None + try: + int(value) + except ValueError: + log.warn("txqueuelen value '%s' is not integer" % value) + return None + if not sim: + # there is inconsistency in "ip", where "txqueuelen" is set as it, but is shown as "qlen" + res = self._call_ip_link(["set", "dev", device, "txqueuelen", value]) + if res is None: + log.warn("Cannot set txqueuelen for device '%s'" % device) + return None + return value + + def _get_re_ip_link_show_qlen(self): + if self._re_ip_link_show_qlen is None: + self._re_ip_link_show_qlen = re.compile(r".*\s+qlen\s+(\d+)") + return self._re_ip_link_show_qlen + + @command_get("txqueuelen") + def _get_txqueuelen(self, device, ignore_missing=False): + out = self._ip_link_show(device) + if out is None: + if not ignore_missing: + log.info("Cannot get 'ip link show' result for txqueuelen value for device '%s'" % device) + return None + res = self._get_re_ip_link_show_qlen().search(out) + if res is None: + # We can theoretically get device without qlen (http://linux-ip.net/gl/ip-cref/ip-cref-node17.html) + if not ignore_missing: + log.info("Cannot get txqueuelen value from 'ip link show' result for device '%s'" % device) + return None + return res.group(1) + # d is dict: {parameter: value} def _check_parameters(self, context, d): if context == "features": diff --git a/tuned/profiles/loader.py b/tuned/profiles/loader.py index 3103718..3cadcb6 100644 --- a/tuned/profiles/loader.py +++ b/tuned/profiles/loader.py @@ -90,7 +90,7 @@ class Loader(object): config = self._load_config_data(filename) profile = self._profile_factory.create(name, config) if "include" in profile.options: - include_names = re.split(r"\b\s*[,;]\s*", self._variables.expand(profile.options.pop("include"))) + include_names = re.split(r"\s*[,;]\s*", self._variables.expand(profile.options.pop("include"))) self._load_profile(include_names, profiles, processed_files) profiles.append(profile) diff --git a/tuned/profiles/locator.py b/tuned/profiles/locator.py index 994bdfb..c250104 100644 --- a/tuned/profiles/locator.py +++ b/tuned/profiles/locator.py @@ -31,6 +31,10 @@ class Locator(object): def get_config(self, profile_name, skip_files=None): ret = None + conditional_load = profile_name[0:1] == "-" + if conditional_load: + profile_name = profile_name[1:] + for dir_name in reversed(self._load_directories): # basename is protection not to get out of the path config_file = self._get_config_filename(dir_name, os.path.basename(profile_name)) @@ -42,6 +46,9 @@ class Locator(object): if os.path.isfile(config_file): return config_file + if conditional_load and ret is None: + ret = "" + return ret def check_profile_name_format(self, profile_name): diff --git a/tuned/version.py b/tuned/version.py index 8f19994..af5451d 100644 --- a/tuned/version.py +++ b/tuned/version.py @@ -1,3 +1,5 @@ TUNED_VERSION_MAJOR = 2 -TUNED_VERSION_MINOR = 16 +TUNED_VERSION_MINOR = 17 TUNED_VERSION_PATCH = 0 + +TUNED_VERSION_STR = "%d.%d.%d" % (TUNED_VERSION_MAJOR, TUNED_VERSION_MINOR, TUNED_VERSION_PATCH)