Skip to content

Commit 8f3b90b

Browse files
mrutland-armwildea01
authored andcommitted
ARM: perf: remove unnecessary checks for idx < 0
We currently check for hwx->idx < 0 in armpmu_read and armpmu_del unnecessarily. The only case where hwc->idx < 0 is when armpmu_add fails, in which case the event's state is set to PERF_EVENT_STATE_INACTIVE. The perf core will not attempt to read from an event in PERF_EVENT_STATE_INACTIVE, and so the check in armpmu_read is unnecessary. Similarly, if perf core cannot add an event it will not attempt to delete it, so the WARN_ON in armpmu_del is unnecessary. This patch removes these two redundant checks. Signed-off-by: Mark Rutland <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent 76b8a0e commit 8f3b90b

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

arch/arm/kernel/perf_event.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,6 @@ u64 armpmu_event_update(struct perf_event *event)
149149
static void
150150
armpmu_read(struct perf_event *event)
151151
{
152-
struct hw_perf_event *hwc = &event->hw;
153-
154-
/* Don't read disabled counters! */
155-
if (hwc->idx < 0)
156-
return;
157-
158152
armpmu_event_update(event);
159153
}
160154

@@ -207,8 +201,6 @@ armpmu_del(struct perf_event *event, int flags)
207201
struct hw_perf_event *hwc = &event->hw;
208202
int idx = hwc->idx;
209203

210-
WARN_ON(idx < 0);
211-
212204
armpmu_stop(event, PERF_EF_UPDATE);
213205
hw_events->events[idx] = NULL;
214206
clear_bit(idx, hw_events->used_mask);

0 commit comments

Comments
 (0)