This commit adds cgroup v1 support to the scheduler plugin. It seems that
cgroup v1 is the default on RHEL-8. Systemd uses it there, so we have to
start with the cgroup v1. On Fedora, systemd has been switched to the
cgroup v2 (tested on f31), but it's still possible to intermix there
with the cgroup v1. We can add cgroup v2 support later (the logic of the
extended syntax will not change).
This commit extends the syntax the following way:
[scheduler]
cgroup_mount_point=/sys/fs/cgroup/cpuset
cgroup_mount_point_init=1
cgroup_groups_init=1
cgroup_for_isolated_cores=group
cgroup.group1=2
cgroup.group2=0,2
group.ksoftirqd=0:f:2:cgroup.group1:ksoftirqd.*
ps_blacklist=ksoftirqd.*;rcuc.*;rcub.*;ktimersoftd.*
isolated_cores=1
--
Legend:
'cgroup_mount_point' is where to mount the cgroup FS or where Tuned
expects it to be mounted. If unset '/sys/fs/cgroup/cpuset' is expected.
'cgroup_groups_init' if set to '1' (the default) it means that Tuned
will create (and remove) all cgroups defined with the 'cgroup*' options.
If set to '0' (or similar boolean) the cgroups need to be preset by
some different tool or by hand.
'cgroup_mount_point_init' if set to '1' (or similar boolean) it means that
Tuned will create (and remove) the cgroup mountpoint. It implies
'cgroup_groups_init = 1'. If set to '0' (the default) the cgroups
mount point needs to be preset by some different tool or by hand.
'cgroup_for_isolated_cores' is the cgroup name used for the
'isolated_cores' functionality. For example here if the system has 4 CPUs,
'isolated_cores=1' means that all threads (except of the blacklisted ones
by the 'ps_blacklist' regexes) will be moved to the CPU cores 0,2,3. It will
be done the way that cgroup 'group' will be set to use the affinity 0,2-3
by the 'cpuset.cpus' control file) and all matching threads will be moved
to this cgroup. If 'cgroup_for_isolated_cores' is unset, classic cpuset
affinity will be used to achieve the goal.
'cgroup.CGROUP_NAME' defines affinities for arbitrary cgroups.
Even hierarchic cgroups can be used, but the hieararchy needs to be
specified in the correct order. Also Tuned doesn't do any sanity checks
here (except that it forces the cgroup to be under the mountpoint).
In the example it defines 'group1' with the affinity set to the CPU 2
and 'group2' with the affinity set to CPUs 0, 2.
'group.' its syntax has been extended, so it's now possible to use
e.g. 'cgroup.group1' instead of the hex affinity and the matching
processes will be moved to the 'group1'. It's also possible to use
cgroups which hasn't been defined by the 'cgroup.' option described
above (e.g. cgroups not managed by Tuned).
Before the usage all cgroup names are sanitized by simple algorithm:
all dots '.' are replaced by slashes '/'. It's to prevent the plugin
to write outside the mount point.
Resolves: rhbz#1784648
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
There should be a way for administrators and testers to force loading of
architecture specific tuning. For example, if there is some specific tuning
for some platforms with specific CPUIDs and the vendor will release new
compatible platform with the new CPUID, there needs to be a way for
administrator to use the tuning on the new platform without waiting for the
Tuned profile update or without the need to customize the profile.
This commit adds two main config options:
uname_string
cpuinfo_string
If unset (commented), which is the default, runtime detection will be used,
i.e. 'uname' will be called and '/proc/cpuinfo' will be read. If set,
content of the variables will be used instead of the runtime detection.
For example by setting:
uname_string = aarch64
It's possible to pretend that Tuned is running on the 64-bit ARM.
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
The 'is' operator is used to determine object identity. What we want
to do here instead is a value comparison, i.e. the "==" operator.
With the 'is' operator, the conditions would likely never evaluate to
true.
This fixes errors such as these (they seem to get produced during byte
compilation; you can trigger them just by running Tuned).
/root/tuned/tuned/plugins/plugin_cpu.py:76: SyntaxWarning: "is" with a literal. Did you mean "=="?
if vendor is "GenuineIntel":
/root/tuned/tuned/plugins/plugin_cpu.py:78: SyntaxWarning: "is" with a literal. Did you mean "=="?
elif vendor is "AuthenticAMD" or vendor is "HygonGenuine":
/root/tuned/tuned/plugins/plugin_cpu.py:78: SyntaxWarning: "is" with a literal. Did you mean "=="?
elif vendor is "AuthenticAMD" or vendor is "HygonGenuine":
This fixes commit 29022a0edf.
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
Profile which tunes down I/O activity to the serial console by reducing the
printk value. This should make the serial console more responsive.
This profile is intended to be used as an overlay on other
profiles (e.g. throughput-performance profile), example:
# tuned-adm profile throughput-performance optimize-serial-console
Also minor fixes to the man page quoting.
Resolves: rhbz#1840689
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Currently the 92-tuned.install kernel-install plugin adds the tuned params
to the BLS config files in s390x machines. But the zipl bootloader doesn't
have support for variables, which leads to cmdlines like the following:
root=/dev/mapper/rhel-root crashkernel=auto rd.dasd=0.0.541f rd.dasd=0.0.551f
rd.dasd=0.0.561f rd.dasd=0.0.571f rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap
cio_ignore=all,!condev rd.znet=qeth,0.0.0600,0.0.0601,0.0.0602,layer2=1,portno=0
$tuned_params BOOT_IMAGE=0
Don't modify the BLS snippet since the zipl bootloader doesn't support the
variables and just make the script to exit if the architecture is s390x.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
There can be lower number of arguments than the max limit.
Also fixed definition of functions which wrongly used the API.
I.e. it should work this way:
# exactly 3 arguments
__init__("FUNC", 3, 3)
# max 4 arguments, min 3 arguments (3 - 4 arguments)
__init__("FUNC", 4, 3)
# max 3 arguments (0 - 3 arguments)
__init__("FUNC", 3)
# min 3 arguments (3 - infinity arguments)
__init__("FUNC", 0, 3)
# arbitrary number of arguments (0 - infinity arguments)
__init__("FUNC", 0)
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Also added regex_search_ternary built-in function.
It takes arguments in the following form:
STR1, REGEX, STR2, STR3
If REGEX matches STR1 (re.search is used), STR2 is returned,
if it doesn't match STR3 is returned.
Example:
[variables]
foo=Y
bar=${f:regex_search_ternary:${foo}:\b[y,Y,1,t,T]\b:foo:bar}
It will result in the 'foo' string stored in the '${bar}' variable.
Resolves: rhbz#1797025
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Currently when grub.cfg file is not found, the [bootloader] plugin still
modifies /etc/tuned/bootcmdline file. However, during rollbacks, the settings
applied to that file are not rolled back. This becomes a problem in
(containerized) environments when grub.cfg file does not exist. This patch
will make the behaviour more consistent and unapply the settings in
/etc/tuned/bootcmdline even when no grub.cfg is found.
Signed-off-by: Jiri Mencak <jmencak@users.noreply.github.com>
'tuned-adm profile' accepts more than one profile. Document it in the
man page.
Resolves: rhbz#1794337
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
Make sure the isolated_cores and no_balance_cores variables are
defined before any of the variables that use them are defined. This
enforces a certain ordering of variable expansions so that child
profiles can set the variables directly in the profile (tuned.conf),
e.g.:
[main]
include=cpu-partitioning
[variables]
isolated_cores=3
Resolves: rhbz#1781664
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>