new-release

resolves: rhbz#1093883
  - fixed traceback if profile cannot be loaded
    related: rhbz#953128
  - powertop2tuned: fixed traceback if rewriting file instead of dir
    resolves: rhbz#963441
  - throughput-performance: altered dirty ratios for better performance
    resolves: rhbz#1043533
  - latency-performance: leaving THP on its default
    resolves: rhbz#1064510
  - used throughput-performance profile on server by default
    resolves: rhbz#1063481
  - network-latency: added new profile
    resolves: rhbz#1052418
  - network-throughput: added new profile
    resolves: rhbz#1052421
  - recommend.conf: fixed config file
    resolves: rhbz#1069123
  - systemd: added cpupower.service conflict
    resolves: rhbz#1073392
  - balanced: used medium_power ALPM policy
  - added support for >, < assignment modifiers in tuned.conf
  - handled root block devices
  - balanced: used conservative CPU governor
    resolves: rhbz#1124125
  - plugins: added selinux plugin
  - plugin_net: added nf_conntrack_hashsize parameter
  - profiles: added atomic-host profile
    resolves: rhbz#1091977
  - profiles: added atomic-guest profile
    resolves: rhbz#1091979
  - moved profile autodetection from post install script to tuned daemon
    resolves: rhbz#1144067
  - profiles: included sap-hana and sap-hana-vmware profiles
  - man: structured profiles manual pages according to sub-packages
  - added missing hdparm dependency
    resolves: rhbz#1144858
  - improved error handling of switch_profile
    resolves: rhbz#1068699
  - tuned-adm: active: detect whether tuned deamon is running
    related: rhbz#1068699
  - removed active_profile from RPM verification
    resolves: rhbz#1104126
  - plugin_disk: readahead value can be now specified in sectors
    resolves: rhbz#1127127
  - plugins: added bootloader plugin
    resolves: rhbz#1044111
  - plugin_disk: added error counter to hdparm calls
  - plugins: added scheduler plugin
    resolves: rhbz#1100826
  - added tuned-gui
This commit is contained in:
Jaroslav Škarvada 2014-10-01 21:07:19 +02:00
parent 80a4f27c8f
commit 2d6381437a
5 changed files with 139 additions and 184 deletions

View File

@ -1 +1 @@
262304f1b3ddd8600aedd6c06be34ae2 tuned-2.3.0.tar.bz2
c72dd8afd24f0f5db81206d432eb75a2 tuned-2.4.0.tar.bz2

View File

@ -1,20 +0,0 @@
diff --git a/tuned/daemon/daemon.py b/tuned/daemon/daemon.py
index 9741cac..804ac0b 100644
--- a/tuned/daemon/daemon.py
+++ b/tuned/daemon/daemon.py
@@ -65,7 +65,6 @@ class Daemon(object):
self._save_active_profile(self._profile.name)
self._unit_manager.start_tuning()
- self._terminate.clear()
while not tuned.utils.commands.wait(self._terminate, self._update_interval):
log.debug("updating monitors")
self._unit_manager.update_monitors()
@@ -105,6 +104,7 @@ class Daemon(object):
log.info("starting tuning")
self._thread = threading.Thread(target=self._thread_code)
+ self._terminate.clear()
self._thread.start()
return True

View File

@ -1,139 +0,0 @@
diff --git a/man/tuned-main.conf.5 b/man/tuned-main.conf.5
index 61a6a4b..6f324be 100644
--- a/man/tuned-main.conf.5
+++ b/man/tuned-main.conf.5
@@ -16,17 +16,31 @@ will be used. Please note if it is enabled here, it is still possible
to individually disable it in plugins.
.TP
+.BI sleep_interval= INT
+Tuned daemon is periodically waken after \fIINT\fR seconds and checks
+for events. By default this is set to 1 second. If you have Python 2
+interpreter with applied patch from Red Hat Bugzilla #917709 this
+controls responsiveness time of Tuned to commands (i.e. if you
+request profile switch, it may take up to 1 second until Tuned reacts).
+Increase this number for higher responsiveness times and more power
+savings (due to lower number of wakeups). In case you have unpatched
+Python 2 interpreter, this settings will have no visible effect,
+because the intepreter will poll 20 times per second.
+
+.TP
.BI update_interval= INT
Update interval for dynamic tuning (in seconds). Tuned daemon is periodically
waken after \fIINT\fR seconds, updates its monitors, calculates new tuning
parameters for enabled plugins and applies the changes. Plugins that have
disabled dynamic tuning are not processed. By default the \fIINT\fR is set
to 10 seconds. Tuned daemon doesn't periodically wake if dynamic tuning is
-globally disabled (see \fBdynamic_tuning\fR).
+globally disabled (see \fBdynamic_tuning\fR) or this setting set to 0.
+This must be multiple of \fBsleep_interval\fR.
.SH EXAMPLE
.nf
dynamic_tuning = 1
+sleep_interval = 1
update_interval = 10
.fi
diff --git a/tuned/consts.py b/tuned/consts.py
index 1dd53ab..6c8dc4b 100644
--- a/tuned/consts.py
+++ b/tuned/consts.py
@@ -18,5 +18,7 @@ SYSTEM_RELEASE_FILE = "/etc/system-release-cpe"
# default configuration
CFG_DEF_DYNAMIC_TUNING = True
+# how long to sleep before checking for events (in seconds)
+CFG_DEF_SLEEP_INTERVAL = 1
# update interval for dynamic tuning (in seconds)
CFG_DEF_UPDATE_INTERVAL = 10
diff --git a/tuned/daemon/application.py b/tuned/daemon/application.py
index f1b5208..e4c9da3 100644
--- a/tuned/daemon/application.py
+++ b/tuned/daemon/application.py
@@ -16,6 +16,7 @@ log = tuned.logs.get()
__all__ = ["Application"]
global_config_spec = ["dynamic_tuning = boolean(default=%s)" % consts.CFG_DEF_DYNAMIC_TUNING,
+ "sleep_interval = integer(default=%s)" % consts.CFG_DEF_SLEEP_INTERVAL,
"update_interval = integer(default=%s)" % consts.CFG_DEF_UPDATE_INTERVAL]
class Application(object):
@@ -31,7 +32,6 @@ class Application(object):
self.config = self._load_global_config()
if self.config.get("dynamic_tuning"):
log.info("dynamic tuning is enabled (can be overriden in plugins)")
- log.info("update interval is %d seconds" % self.config.get("update_interval"))
else:
log.info("dynamic tuning is globally disabled")
@@ -44,7 +44,7 @@ class Application(object):
profile_loader = profiles.Loader(profile_locator, profile_factory, profile_merger)
- self._daemon = daemon.Daemon(unit_manager, profile_loader, profile_name, int(self.config.get("update_interval", consts.CFG_DEF_UPDATE_INTERVAL)))
+ self._daemon = daemon.Daemon(unit_manager, profile_loader, profile_name, self.config)
self._controller = controller.Controller(self._daemon)
self._dbus_exporter = None
diff --git a/tuned/daemon/daemon.py b/tuned/daemon/daemon.py
index 804ac0b..35f60c2 100644
--- a/tuned/daemon/daemon.py
+++ b/tuned/daemon/daemon.py
@@ -9,9 +9,27 @@ log = tuned.logs.get()
class Daemon(object):
- def __init__(self, unit_manager, profile_loader, profile_name=None, update_interval = int(consts.CFG_DEF_UPDATE_INTERVAL)):
+ def __init__(self, unit_manager, profile_loader, profile_name=None, config=None):
log.debug("initializing daemon")
- self._update_interval = update_interval
+ self._sleep_interval = int(consts.CFG_DEF_SLEEP_INTERVAL)
+ self._update_interval = int(consts.CFG_DEF_UPDATE_INTERVAL)
+ self._dynamic_tuning = consts.CFG_DEF_DYNAMIC_TUNING
+ if config is not None:
+ self._sleep_interval = int(config.get("sleep_interval", consts.CFG_DEF_SLEEP_INTERVAL))
+ self._update_interval = int(config.get("update_interval", consts.CFG_DEF_UPDATE_INTERVAL))
+ self._dynamic_tuning = config.get("dynamic_tuning", consts.CFG_DEF_DYNAMIC_TUNING)
+ if self._sleep_interval <= 0:
+ self._sleep_interval = int(consts.CFG_DEF_SLEEP_INTERVAL)
+ if self._update_interval == 0:
+ self._dynamic_tuning = False
+ elif self._update_interval < self._sleep_interval:
+ self._update_interval = self._sleep_interval
+ self._sleep_cycles = self._update_interval // self._sleep_interval
+ log.info("using sleep interval of %d second(s)" % self._sleep_interval)
+ if self._dynamic_tuning:
+ log.info("dynamic tuning is enabled (can be overriden by plugins)")
+ log.info("using update interval of %d second(s) (%d times of the sleep interval)" % (self._sleep_cycles * self._sleep_interval, self._sleep_cycles))
+
self._unit_manager = unit_manager
self._profile_loader = profile_loader
self._init_threads()
@@ -65,11 +83,21 @@ class Daemon(object):
self._save_active_profile(self._profile.name)
self._unit_manager.start_tuning()
- while not tuned.utils.commands.wait(self._terminate, self._update_interval):
- log.debug("updating monitors")
- self._unit_manager.update_monitors()
- log.debug("performing tunings")
- self._unit_manager.update_tuning()
+ # In python 2 interpreter with applied patch for rhbz#917709 we need to periodically
+ # poll, otherwise the python will not have chance to update events / locks (due to GIL)
+ # and e.g. DBus control will not work. The polling interval of 1 seconds (which is
+ # the default) is still much better than 50 ms polling with unpatched interpreter.
+ # For more details see tuned rhbz#917587.
+ _sleep_cnt = self._sleep_cycles
+ while not tuned.utils.commands.wait(self._terminate, self._sleep_interval):
+ if self._dynamic_tuning:
+ _sleep_cnt -= 1
+ if _sleep_cnt <= 0:
+ _sleep_cnt = self._sleep_cycles
+ log.debug("updating monitors")
+ self._unit_manager.update_monitors()
+ log.debug("performing tunings")
+ self._unit_manager.update_tuning()
self._unit_manager.stop_tuning()
self._unit_manager.destroy_all()

View File

@ -0,0 +1,13 @@
diff --git a/org.tuned.gui.policy b/org.tuned.gui.policy
index 58b6209..68b15d8 100644
--- a/org.tuned.gui.policy
+++ b/org.tuned.gui.policy
@@ -10,7 +10,7 @@
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin</allow_active>
</defaults>
- <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/tuned-gui</annotate>
+ <annotate key="org.freedesktop.policykit.exec.path">/usr/sbin/tuned-gui</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

View File

@ -1,7 +1,7 @@
Summary: A dynamic adaptive system tuning daemon
Name: tuned
Version: 2.3.0
Release: 4%{?dist}
Version: 2.4.0
Release: 1%{?dist}
License: GPLv2+
Source: https://fedorahosted.org/releases/t/u/tuned/tuned-%{version}.tar.bz2
URL: https://fedorahosted.org/tuned/
@ -11,9 +11,9 @@ Requires(post): systemd, virt-what
Requires(preun): systemd
Requires(postun): systemd
Requires: python-decorator, dbus-python, pygobject3-base, python-pyudev
Requires: virt-what, python-configobj, ethtool, gawk, kernel-tools
Patch0: tuned-2.3.0-fix-race.patch
Patch1: tuned-2.3.0-timing-improvements.patch
Requires: virt-what, python-configobj, ethtool, gawk, kernel-tools, hdparm
Requires: util-linux
Patch0: tuned-2.4.0-polkit-tuned-gui-path.patch
%description
The tuned package contains a daemon that tunes system settings dynamically.
@ -22,10 +22,18 @@ Based on that information components will then be put into lower or higher
power saving modes to adapt to the current usage. Currently only ethernet
network and ATA harddisk devices are implemented.
%package gtk
Summary: GTK GUI for tuned
Requires: %{name} = %{version}-%{release}
Requires: powertop, pygobject3-base, polkit
%description gtk
GTK GUI that can control tuned and provide simple profile editor.
%package utils
Requires: %{name} = %{version}-%{release}
Summary: Various tuned utilities
Requires: powertop
Summary: Various tuned utilities
%description utils
This package contains utilities that can help you to fine tune and
@ -43,6 +51,27 @@ minimal, maximal and average time between operations to be able to
identify applications that behave power inefficient (many small operations
instead of fewer large ones).
%package profiles-sap
Summary: Additional tuned profile(s) targeted to SAP NetWeaver loads
Requires: %{name} = %{version}-%{release}
%description profiles-sap
Additional tuned profile(s) targeted to SAP NetWeaver loads.
%package profiles-sap-hana
Summary: Additional tuned profile(s) targeted to SAP HANA loads
Requires: %{name} = %{version}-%{release}
%description profiles-sap-hana
Additional tuned profile(s) targeted to SAP HANA loads.
%package profiles-atomic
Summary: Additional tuned profiles targeted to Atomic
Requires: %{name} = %{version}-%{release}
%description profiles-atomic
Additional tuned profiles targeted to Atomic host and guest.
%package profiles-compat
Summary: Additional tuned profiles mainly for backward compatibility with tuned 1.0
Requires: %{name} = %{version}-%{release}
@ -54,7 +83,6 @@ It can be also used to fine tune your system for specific scenarios.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%build
@ -66,21 +94,10 @@ make install DESTDIR=%{buildroot}
sed -i 's/\(dynamic_tuning[ \t]*=[ \t]*\).*/\10/' %{buildroot}%{_sysconfdir}/tuned/tuned-main.conf
%endif
# move docs to unversioned directory
mv %{buildroot}%{_docdir}/%{name}-%{version} %{buildroot}%{_docdir}/%{name}
%post
%systemd_post tuned.service
# try to autodetect the best profile for the system in case there is none preset
if [ ! -f /etc/tuned/active_profile -o -z "`cat /etc/tuned/active_profile 2>/dev/null`" ]
then
PROFILE=`/usr/sbin/tuned-adm recommend 2>/dev/null`
[ "$PROFILE" ] || PROFILE=balanced
/usr/sbin/tuned-adm profile "$PROFILE" 2>/dev/null || echo -n "$PROFILE" > /etc/tuned/active_profile
fi
# convert active_profile from full path to name (if needed)
sed -i 's|.*/\([^/]\+\)/[^\.]\+\.conf|\1|' /etc/tuned/active_profile
@ -105,7 +122,8 @@ sed -i 's|.*/\([^/]\+\)/[^\.]\+\.conf|\1|' /etc/tuned/active_profile
%doc COPYING
%doc README
%doc doc/TIPS.txt
%{_sysconfdir}/bash_completion.d
%{_datadir}/bash-completion/completions/tuned
%exclude %{python_sitelib}/tuned/gtk
%{python_sitelib}/tuned
%{_sbindir}/tuned
%{_sbindir}/tuned-adm
@ -116,20 +134,35 @@ sed -i 's|.*/\([^/]\+\)/[^\.]\+\.conf|\1|' /etc/tuned/active_profile
%exclude %{_prefix}/lib/tuned/laptop-battery-powersave
%exclude %{_prefix}/lib/tuned/enterprise-storage
%exclude %{_prefix}/lib/tuned/spindown-disk
%exclude %{_prefix}/lib/tuned/sap-netweaver
%exclude %{_prefix}/lib/tuned/sap-hana
%exclude %{_prefix}/lib/tuned/sap-hana-vmware
%exclude %{_prefix}/lib/tuned/atomic-host
%exclude %{_prefix}/lib/tuned/atomic-guest
%{_prefix}/lib/tuned
%dir %{_sysconfdir}/tuned
%config(noreplace) %{_sysconfdir}/tuned/active_profile
%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/tuned/active_profile
%config(noreplace) %{_sysconfdir}/tuned/tuned-main.conf
%{_sysconfdir}/tmpfiles.d
%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/tuned/bootcmdline
%{_sysconfdir}/dbus-1/system.d/com.redhat.tuned.conf
%{_sysconfdir}/grub.d/00_tuned
%{_tmpfilesdir}/tuned.conf
%{_unitdir}/tuned.service
%dir %{_localstatedir}/log/tuned
%dir /run/tuned
%{_mandir}/man5/tuned*
%{_mandir}/man7/tuned-profiles.7*
%{_mandir}/man8/tuned*
%dir %{_datadir}/tuned
%files gtk
%defattr(-,root,root,-)
%{_sbindir}/tuned-gui
%{python_sitelib}/tuned/gtk
%{_datadir}/tuned/ui
%{_datadir}/polkit-1/actions/org.tuned.gui.policy
%files utils
%defattr(-,root,root,-)
%doc COPYING
%{_bindir}/powertop2tuned
%{_libexecdir}/tuned/pmqos-static*
@ -148,6 +181,23 @@ sed -i 's|.*/\([^/]\+\)/[^\.]\+\.conf|\1|' /etc/tuned/active_profile
%{_mandir}/man8/diskdevstat.*
%{_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
%{_prefix}/lib/tuned/sap-hana-vmware
%{_mandir}/man7/tuned-profiles-sap-hana.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-compat
%defattr(-,root,root,-)
%{_prefix}/lib/tuned/default
@ -157,10 +207,61 @@ sed -i 's|.*/\([^/]\+\)/[^\.]\+\.conf|\1|' /etc/tuned/active_profile
%{_prefix}/lib/tuned/laptop-battery-powersave
%{_prefix}/lib/tuned/enterprise-storage
%{_prefix}/lib/tuned/spindown-disk
%{_mandir}/man7/tuned-profiles-compat.7*
%changelog
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.3.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed Oct 1 2014 Jaroslav Škarvada <jskarvad@redhat.com> - 2.4.0-1
- new-release
resolves: rhbz#1093883
- fixed traceback if profile cannot be loaded
related: rhbz#953128
- powertop2tuned: fixed traceback if rewriting file instead of dir
resolves: rhbz#963441
- throughput-performance: altered dirty ratios for better performance
resolves: rhbz#1043533
- latency-performance: leaving THP on its default
resolves: rhbz#1064510
- used throughput-performance profile on server by default
resolves: rhbz#1063481
- network-latency: added new profile
resolves: rhbz#1052418
- network-throughput: added new profile
resolves: rhbz#1052421
- recommend.conf: fixed config file
resolves: rhbz#1069123
- systemd: added cpupower.service conflict
resolves: rhbz#1073392
- balanced: used medium_power ALPM policy
- added support for >, < assignment modifiers in tuned.conf
- handled root block devices
- balanced: used conservative CPU governor
resolves: rhbz#1124125
- plugins: added selinux plugin
- plugin_net: added nf_conntrack_hashsize parameter
- profiles: added atomic-host profile
resolves: rhbz#1091977
- profiles: added atomic-guest profile
resolves: rhbz#1091979
- moved profile autodetection from post install script to tuned daemon
resolves: rhbz#1144067
- profiles: included sap-hana and sap-hana-vmware profiles
- man: structured profiles manual pages according to sub-packages
- added missing hdparm dependency
resolves: rhbz#1144858
- improved error handling of switch_profile
resolves: rhbz#1068699
- tuned-adm: active: detect whether tuned deamon is running
related: rhbz#1068699
- removed active_profile from RPM verification
resolves: rhbz#1104126
- plugin_disk: readahead value can be now specified in sectors
resolves: rhbz#1127127
- plugins: added bootloader plugin
resolves: rhbz#1044111
- plugin_disk: added error counter to hdparm calls
- plugins: added scheduler plugin
resolves: rhbz#1100826
- added tuned-gui
* Thu Mar 6 2014 Jaroslav Škarvada <jskarvad@redhat.com> - 2.3.0-3
- added kernel-tools requirement