tuned icon indicating copy to clipboard operation
tuned copied to clipboard

Device-independent, instance-specific tuning

Open adriaan42 opened this issue 7 months ago • 0 comments

Follow-up to https://github.com/redhat-performance/tuned/pull/596#issuecomment-2122983714

There is an inconsistency in when the static tuning of an instance is applied:

  • Static tuning is only executed at startup (via instance_apply_tuning)
  • If at that time, the instance is not active (has no devices attached), static tuning is skipped
  • If devices are assigned to the instance later, it becomes active, but static tuning is not triggered
  • If the instance shuts down, it's now active, and static tuning will be unapplied
  • Same situation can happen in "reverse": If an instance starts out with devices, its static tuning will be applied. If then the devices are detached, it becomes inactive, and on shutdown its static tuning will never be unapplied.

I don't think any of the current plugins has a problem with this, but it's an issue for my PR #628, where I'm trying to use _instance_[un]apply_static to determine the number of active instances (https://github.com/adriaan42/tuned/blob/adriaan/kthreads/tuned/plugins/plugin_kthread.py#L272).

I see two possible solutions (there may be more):

  1. Always (un)apply the static instance tuning, even if the instance is inactive. This would be easy to implement, but sounds wrong.
  2. Track when an instance becomes active (first device is attached) or inactive (last device is detached) and then apply or unapply the static tuning. Since I believe adding/removing devices can be triggered by multiple threads, we'd probably need to add a lock here... so possible not so easy, but sounds a but more right than (1).

adriaan42 avatar Jul 25 '24 05:07 adriaan42