Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor dynamic tuning and add per-plugin global configuration #626

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

zacikpa
Copy link
Contributor

@zacikpa zacikpa commented Apr 15, 2024

In this PR, I add a global per-plugin configuration of dynamic tuning, which works as follows:

  1. The boolean dynamic_tuning option stays as it is - it can be used to globally enable or disable dynamic tuning in all plugins.
  2. When dynamic_tuning is on, one can use the new dynamic_plugins option to restrict the set of plugins which can perform dynamic tuning. For instance, setting dynamic_plugins=scheduler,disk enables dynamic tuning only for the two plugins.
  3. On plugin instance level, one can still disable dynamic tuning by setting dynamic=0 in the profile configuration. This now works for all plugins with dynamic capabilities.

Secondly, I integrated the "runtime" functionality of the scheduler plugin under dynamic tuning. To do so, we need to distinguish between dynamic plugins that are updated periodically by the main daemon thread (currently, all except the scheduler plugin) and dynamic plugins that implement their tuning in their own thread.

The changes required quite a bit of refactoring. I believe the code could be made even cleaner by creating a separate subclass of Plugin for the dynamic plugins, but that would require even more massive refactoring, so I'm not sure if it's worth doing at this point.

tuned/plugins/plugin_eeepc_she.py Fixed Show fixed Hide fixed
tuned/plugins/plugin_scheduler.py Fixed Show fixed Hide fixed
tuned/plugins/plugin_eeepc_she.py Fixed Show fixed Hide fixed
@zacikpa zacikpa force-pushed the per-plugin-dynamic branch 2 times, most recently from 3e17127 to c513217 Compare April 15, 2024 15:33
@zacikpa zacikpa force-pushed the per-plugin-dynamic branch 5 times, most recently from c061d7e to 4c3020c Compare April 16, 2024 08:48
@zacikpa zacikpa requested a review from yarda April 16, 2024 12:13
@zacikpa zacikpa marked this pull request as ready for review April 16, 2024 12:14
@yarda
Copy link
Contributor

yarda commented May 23, 2024

Please resolve conflicts.

@zacikpa zacikpa force-pushed the per-plugin-dynamic branch 2 times, most recently from 6d45946 to d61116b Compare May 28, 2024 11:54
Add a new global option "dynamic_plugins" which can be
used to globally enable dynamic tuning only for specific
plugins.

Also unify the behavior of the "dynamic" profile option
for plugins with dynamic capabilities. All such plugins
now have this option and it is set to True by default.
Dynamic tuning is then enabled for a specific plugin
if it is allowed both globally and locally.
Let plugins choose between the default (periodic)
dynamic tuning and their own implementation.

If a plugin uses the default periodic tuning,
it must implement the update_tuning method
which is then periodically called by the main
daemon thread.

Non-periodic implementations may, e.g., start
their own threads.
Remove the "runtime" option from the scheduler plugin
and integrate its functionality into dynamic tuning.
Currently, the scheduler plugin is the only dynamic
plugin with its own implementation of dynamic tuning
(not initiated periodically by the main daemon thread).

Adjust default global configuration so that dynamic tuning
is enabled by default, but only for the scheduler plugin.
@zacikpa
Copy link
Contributor Author

zacikpa commented May 28, 2024

Please resolve conflicts.

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants