Skip to content

Commit

Permalink
ARM: perf: remove unnecessary checks for idx < 0
Browse files Browse the repository at this point in the history
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 <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
  • Loading branch information
Mark Rutland authored and Will Deacon committed Jan 18, 2013
1 parent 76b8a0e commit 8f3b90b
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions arch/arm/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,6 @@ u64 armpmu_event_update(struct perf_event *event)
static void
armpmu_read(struct perf_event *event)
{
struct hw_perf_event *hwc = &event->hw;

/* Don't read disabled counters! */
if (hwc->idx < 0)
return;

armpmu_event_update(event);
}

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

WARN_ON(idx < 0);

armpmu_stop(event, PERF_EF_UPDATE);
hw_events->events[idx] = NULL;
clear_bit(idx, hw_events->used_mask);
Expand Down

0 comments on commit 8f3b90b

Please sign in to comment.