Skip to content

Commit 3e91c01

Browse files
committed
fix: workaround for #662
Calls to our _instance_[un]apply_static() are unreliable [1], so we can't use them to keep track of the active-instance count, to start/stop the perf monitor thread on demand. Instead, this keeps the thread running continuously. [1] #662 Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
1 parent d6bbcc6 commit 3e91c01

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

tuned/plugins/plugin_kthread.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ def __init__(self, monitor_repository, storage_factory, hardware_inventory, devi
132132

133133
def cleanup(self):
134134
super(KthreadPlugin, self).cleanup()
135+
# workaround for #662: shut down the monitor thread
136+
self._perf_monitor_shutdown()
135137
self._perf_shutdown()
136138

137139
#
@@ -142,6 +144,8 @@ def _init_devices(self):
142144
self._free_devices = set()
143145
self._assigned_devices = set()
144146
self._kthread_scan(initial=True)
147+
# workaround for #662: always run the monitor thread
148+
self._perf_monitor_start()
145149

146150
@classmethod
147151
def _get_config_options(cls):
@@ -265,19 +269,23 @@ def _get_matching_devices(self, instance, devices):
265269
matching_devices.add(device)
266270
return matching_devices
267271

268-
def _instance_apply_static(self, instance):
269-
if self._instance_count == 0:
270-
# scan for kthreads that have appeared since plugin initialization
271-
self._kthread_scan(initial=False)
272-
self._perf_monitor_start()
273-
self._instance_count += 1
274-
super(KthreadPlugin, self)._instance_apply_static(instance)
275-
276-
def _instance_unapply_static(self, instance, rollback):
277-
super(KthreadPlugin, self)._instance_unapply_static(instance, rollback)
278-
self._instance_count -= 1
279-
if self._instance_count == 0:
280-
self._perf_monitor_shutdown()
272+
# workaround for #662:
273+
# calls to our _instance_[un]apply_static() are unreliable, so we can't
274+
# use them to count active instances and start/stop the monitor thred
275+
# on demand (https://github.com/redhat-performance/tuned/issues/662)
276+
#def _instance_apply_static(self, instance):
277+
# if self._instance_count == 0:
278+
# # scan for kthreads that have appeared since plugin initialization
279+
# self._kthread_scan(initial=False)
280+
# self._perf_monitor_start()
281+
# self._instance_count += 1
282+
# super(KthreadPlugin, self)._instance_apply_static(instance)
283+
284+
#def _instance_unapply_static(self, instance, rollback):
285+
# super(KthreadPlugin, self)._instance_unapply_static(instance, rollback)
286+
# self._instance_count -= 1
287+
# if self._instance_count == 0:
288+
# self._perf_monitor_shutdown()
281289

282290
#
283291
# internal bookkeeping (self._kthreads)

0 commit comments

Comments
 (0)