redhat-performance / tuned

Tuning Profile Delivery Mechanism for Linux
GNU General Public License v2.0
751 stars 171 forks source link

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

Open zacikpa opened 2 months ago

zacikpa commented 2 months ago

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.

yarda commented 1 month ago

Please resolve conflicts.

zacikpa commented 1 month ago

Please resolve conflicts.

Done.