1
0
Fork 0
Commit graph

1063 commits

Author SHA1 Message Date
Ondřej Lysoněk
c1bc257563 scheduler: Replace get_process with _get_cmdline
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 14:58:13 +02:00
Ondřej Lysoněk
7da6e4adc9 scheduler: Use procfs to list processes
Use procfs instead of the ps command to list processes.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 14:55:16 +02:00
Ondřej Lysoněk
b4ddf47448 scheduler: Add a function for checking if a task is a kthread
Add a function for checking if a task is a kernel thread.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 14:54:38 +02:00
Ondřej Lysoněk
00cda573e3 scheduler: Use schedutils in _set_rt() and _get_rt()
Rewrite _set_rt() and _get_rt() to use schedutils instead of
command line tools.

Behaviour change: previously if the scheduling policy was set to "*"
in a profile, e.g.
[scheduler]
group.foo=0:*:1:1:a.out

then Tuned would set the scheduling policy to SCHED_OTHER on RHEL-7,
and to SCHED_RR on Fedora (at least Fedora 27). This is due to the
behaviour of the "chrt" tool. It behaved this way despite what it
says in the following commit, which says the scheduler will not be
changed if set to "*":
https://github.com/redhat-performance/tuned/commit/bf42cb9ba3c

This commit changes/fixes that, so that the scheduling policy is
in fact not changed if "*" is specified.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 14:28:17 +02:00
Ondřej Lysoněk
ea896e3501 scheduler: Tune scheduler and affinity independently
Set scheduler policy and affinity independently so that when reading
original state of one of the parameters fails, we can still set
the other one.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 13:39:02 +02:00
Ondřej Lysoněk
bfc670dffc scheduler: Don't tune a process if reading original parameters failed
We should not touch a process if we cannot later revert to it's
original state.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 13:38:04 +02:00
Ondřej Lysoněk
5ad1f42beb scheduler: Make instance._sched_cfg a local variable
It's not needed anywhere else.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 13:37:13 +02:00
Ondřej Lysoněk
474a6eff90 scheduler: Always store PIDs as integers
Always store PIDs as integers as that is their natural form.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 13:32:58 +02:00
Ondřej Lysoněk
7ec58f779a scheduler: Improve code readability
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 13:19:02 +02:00
Ondřej Lysoněk
7e3819b446 scheduler: Refactor
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 13:18:21 +02:00
Ondřej Lysoněk
a0c906bff1 scheduler: Drop no_error argument in _set_rt()
I believe it was originally added so that errors are not logged
when we fail to set the scheduling parameters of a short-lived
process which has already disappeared. This is no longer necessary,
because we always check if the process has disappeared, and log
debug messages instead of errors if it has.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 13:14:25 +02:00
Ondřej Lysoněk
a897259eec scheduler: Drop no_error argument in _set_affinity()
I believe it was originally added so that errors are not logged
when we fail to set the affinity of a short-lived process which
has already disappeared. This is no longer necessary, because we
always check if the process has disappeared, and log debug messages
instead of errors if it has.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 13:12:24 +02:00
Ondřej Lysoněk
673d253ac1 scheduler: Drop no_error argument in _get_affinity()
I believe it was originally added so that errors are not logged
when we fail to read the affinity of a short-lived process which
has already disappeared. This is no longer necessary, because we
always check if the process has disappeared, and log debug messages
instead of errors if it has.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 13:10:10 +02:00
Ondřej Lysoněk
8e68e22757 Use the errno attribute of an exception instead of indices
Obtaining the errno from an exception using e[0] is not
possible in Python3.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 13:09:06 +02:00
Ondřej Lysoněk
02541dfb5c scheduler: Catch OSError in addition to IOError
In python3, functions such as open() or readline() raise OSError
instead of IOError.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 13:07:38 +02:00
Ondřej Lysoněk
625d219f9e scheduler: Make storage global for the whole plugin
It doesn't make much sense to have multiple instances of the scheduler
plugin, so let's make storage global for the plugin.

Later we should make Tuned report an error if the user defines multiple
instances of the scheduler plugin.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 13:05:25 +02:00
Ondřej Lysoněk
5bfb596a7c Unify storage keys
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 12:52:08 +02:00
Ondřej Lysoněk
e9fcd4525d Fix storage access
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 12:50:08 +02:00
Ondřej Lysoněk
f3f05e426f scheduler: Prevent a traceback
Add a new method for restoring original CPU affinity of processes
_restore_ps_affinity() and call that in _instance_init() instead of
_instance_unapply_static(). _instance_unapply_static() touches
instance._terminate, which does not yet exist at that point
(_instance_init always gets a fresh instance object).

The reason this was not a problem in the past is that the true branch
of "if len(instance._scheduler_original) > 0:" was never executed,
because instance._scheduler_original was never correctly saved
to storage. The next commit in this patch series fixes that.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 12:48:06 +02:00
Ondřej Lysoněk
e511d70d40 scheduler: Fix reverting CPU affinity in process groups
Previously CPU affinity of tasks created while Tuned was running
was not correctly reverted on Tuned shutdown.

Reproducer (on a 4 core machine):
$ mkdir /etc/tuned/test
$ cat > /etc/tuned/test/tuned.conf << EOF
[scheduler]
group.foo=00:1:a.out
EOF
$ cat > a.c << EOF
 #include <unistd.h>

int main(void)
{
	pause();
	return 0;
}
EOF
$ gcc a.c
$ systemctl start tuned
$ ./a.out &
$ systemctl stop tuned
$ taskset -p $(pgrep a.out)
pid 9950's current affinity mask: 1  <<< should be "f"

Known issue: if you run the above reproducer with the config below
after this commit is applied, the affinity of the task after stopping
tuned will be 0xd, not 0xf. This is because after starting tuned, first
the affinity of the shell session is set to the non-isolated cores (0xd).
Then when ./a.out starts, it inherits that affinity. Then when tuned tunes
the affinity of the ./a.out process, it remembers 0xd as its old affinity
rather than 0xf. It is unclear to me at this point whether we should do
anything about this issue. Properly fixing it would require tracing where
processes get their affinity from.

[scheduler]
group.foo=00:1:a.out
ps_blacklist=.*a.out.*
isolated_cores=1

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-04 12:47:12 +02:00
Jaroslav Škarvada
72c94b3614
plugin_scheduler: whitelist/blacklist processed also for thread names
Resolves: rhbz#1512295

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2018-05-18 15:04:18 +02:00
Jaroslav Škarvada
e0c73cbbfa
bootloader: added check for petitboot
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2018-05-16 15:57:47 +02:00
Jaroslav Škarvada
90cfb257a9
Merge pull request #100 from olysonek/energy_perf_policy
Fix setting EPB on Linux 4.13+, support specifying alternative EPB values
2018-05-14 10:44:55 +02:00
Ondřej Lysoněk
726ea77b70 Use value powersave|power for EPB in powersave profile
Since Linux 4.13 the value "powersave" in the x86_energy_perf_policy
program has been renamed to "power". Let's try both values when
applying the powersave profile.

Resolves: rhbz#1508468

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-05-14 09:45:59 +02:00
Ondřej Lysoněk
07159dfb0a cpu: Support specifying alternative EPB values
Support specifying alternative Energy Performance Bias values.
The values are separated using the '|' character. For example,
if you have the following in your profile:

[cpu]
energy_perf_bias=powersave|power

then tuned will try to set EPB to 'powersave', and if that fails,
it will try to set it to 'power'.

Resolves: rhbz#1508468

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-05-14 09:45:54 +02:00
Ondřej Lysoněk
3104141ff6 cpu: Fix verification of EPB on Linux 4.13+
Fix verification of Energy Performance Bias on Linux 4.13+.
In Linux 4.13, the value strings accepted by the x86_energy_perf_policy
program changed.

Resolves: rhbz#1508468

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-05-14 09:45:48 +02:00
Jaroslav Škarvada
c2eb0858d1
Merge pull request #99 from olysonek/verify_cpumask
Fix verifying cpumask on systems with more than 32 cores
2018-05-03 11:50:56 +02:00
Jaroslav Škarvada
a0c55642b0
spec: fixed python3-gobject-base requirement
Related: rhbz#1537205

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2018-05-02 11:32:27 +02:00
Ondřej Lysoněk
3d9f976318 Fix verifying cpumask on systems with more than 32 cores
Previously verifying the value of a cpumask on systems with more than
32 cores always failed. There are two reasons for this:
1. When there are more than 32 cores, string comparison is done on the
   cpu masks. This failed because the value read from sysfs contained
   a line feed and was not stripped.
2. The cpumask value was not properly normalized when the value had multiple
   non-zero comma separated parts, e.g. '00ffffff,80808000'

Resolves: rhbz#1528368
2018-05-01 14:51:32 +02:00
Jaroslav Škarvada
412c1d203c
spec: dropped kvm_tests leftovers
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2018-04-30 11:57:13 +02:00
Jaroslav Škarvada
5d0a9d9198
Merge pull request #97 from olysonek/exception_handling
Catch unhandled exceptions
2018-04-29 20:51:42 +02:00
Ondřej Lysoněk
f4da2376d9 Catch unhandled exceptions
Catch exceptions not handled elsewhere to make applying, unapplying
and verifying a profile more robust.

Related: rhbz#1571403

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-04-29 11:30:46 +02:00
Jaroslav Škarvada
f94db01f6b
Merge pull request #96 from olysonek/fixes
bootloader: Check if grub2_cfg_file_name is None in _remove_grub2_tuning()
2018-04-25 17:06:22 +02:00
Ondřej Lysoněk
dce9ad2941 bootloader: Check if grub2_cfg_file_name is None in _remove_grub2_tuning()
Resolves: rhbz#1571403
Fixes #82
2018-04-25 08:43:59 +02:00
Jaroslav Škarvada
d25e8b807b
makefile: dropped KVM unit tests, now provided by standalone package
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2018-03-28 16:14:12 +02:00
Jaroslav Škarvada
90c371fc00
sysctl: support assignment modifiers as other plugins do
I.e. one can now write:
[sysctl]
kernel.pid_max=>32768

And the kernel.pid_max will be set to 32768 if the current value is
lower or untouched if it is higher (i.e. it will be 32768 or higher).

Related: rhbz#1561005

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2018-03-28 16:06:48 +02:00
Jaroslav Škarvada
0653b3c7a3
spec: used weak deps for tuned-profiles-nfv-host-bin
It's x86 exclusive, so that's why weak deps are used.

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2018-03-23 18:26:27 +01:00
Jaroslav Škarvada
ee7067a46a
Added requires to tuned-profiles-nfv-host-bin
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2018-03-20 15:09:03 +01:00
Jaroslav Škarvada
c9df4884e3
Dropped tuned-profiles-nfv-host-bin subpackage
It's now packaged as a standalone architecture specific package:
https://bugzilla.redhat.com/show_bug.cgi?id=1551153

Other packagers are encouraged to do the same.

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2018-03-20 15:01:27 +01:00
Jaroslav Škarvada
093429392e
Merge pull request #94 from jtpittman195/readahead_branch
tuned: Add readahead comment to throughput-performance tuned.conf
2018-03-08 10:56:11 +01:00
John Pittman
8cccd5a0eb tuned: Add readahead comment to throughput-performance tuned.conf
A common source of confusion within tuned is the lack of suffix
on the readahead specification in the throughput-performance
tuned.conf. This confusion is resolved, in general, by comparing
the value, for example, to blockdev or lvdisplay output. Avoid
future end-user confusion by adding a comment to the
throughput-performance tuned.conf file, explaining that the default
is in KiB, and noting the allowance of a sector suffix as well.

Signed-off-by: John Pittman <jpittman@redhat.com>
2018-03-07 15:53:39 -05:00
Jaroslav Škarvada
cd52c9ea08
oracle: fixed ip_local_port_range parity warning
Resolves: rhbz#1527219

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2018-03-02 23:37:51 +01:00
Jaroslav Škarvada
d76dc3d62b
Merge pull request #92 from olysonek/no_balance_cpus
Consistently use 'balance' instead of 'rebalance' in cpu-partitioning
2018-03-01 17:00:20 +01:00
Ondřej Lysoněk
6a9068ed0a Consistently use 'balance' instead of 'rebalance' in cpu-partitioning
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-03-01 16:05:13 +01:00
Jaroslav Škarvada
280ac3d3f9
cpu-partitioning: fixed comment in cpu-partitioning-variables.conf
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2018-02-28 17:17:53 +01:00
Jaroslav Škarvada
7b5fa2728a
Merge pull request #91 from olysonek/kthread
Use PF_KTHREAD to identify kernel threads
2018-02-28 15:21:53 +01:00
Ondřej Lysoněk
4f5cb7e4fb Use PF_KTHREAD to identify kernel threads
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-02-28 15:11:54 +01:00
Jaroslav Škarvada
09d8ebf469
tuned-profiles-cpu-partitioning: minor improvements
Added quoting for slashes.
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2018-02-26 10:16:54 +01:00
Luiz Capitulino
9b0479f8a6 add tuned-profiles-cpu-partitioning.7
The manpage already exists, but it's empty. So, this commit actually
adds the content. Also, update the AUTHORS, FILES and SEE ALSO sections.

Resolves: rhbz#1548148

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2018-02-26 10:07:46 +01:00
Luiz Capitulino
c614ad03ff realtime-virtual-host: script.sh: add error checking
At the very least we get errors logged.

Resolves: rhbz#1461509

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2018-02-22 21:03:16 +01:00