Skip to content

Commit

Permalink
scheduler: Do not assume that perf events have type attribute
Browse files Browse the repository at this point in the history
The perf.evlist.read_on_cpu function may return instances of
classes that do not have the type attribute, e.g. perf.lost_event.
Make sure we do not read the type attribute if we are not sure
that it exists.

Resolves: RHEL-60898
  • Loading branch information
zacikpa committed Sep 30, 2024
1 parent c082797 commit 9935a95
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tuned/plugins/plugin_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,10 +1098,13 @@ def _thread_code(self, instance):
event = instance._evlist.read_on_cpu(cpu)
if event:
read_events = True
if event.type == perf.RECORD_COMM or \
(self._perf_process_fork_value and event.type == perf.RECORD_FORK):
if isinstance(event, perf.comm_event) or (
self._perf_process_fork_value
and isinstance(event, perf.task_event)
and event.type == perf.RECORD_FORK
):
self._add_pid(instance, int(event.tid), r)
elif event.type == perf.RECORD_EXIT:
elif isinstance(event, perf.task_event) and event.type == perf.RECORD_EXIT:
self._remove_pid(instance, int(event.tid))

@command_custom("cgroup_ps_blacklist", per_device = False)
Expand Down

0 comments on commit 9935a95

Please sign in to comment.