[PATCH v3 33/57] perf: Simplify perf_adjust_freq_unthr_context()
Peter Zijlstra
peterz at infradead.org
Mon Jun 12 09:07:46 UTC 2023
Signed-off-by: Peter Zijlstra (Intel) <peterz at infradead.org>
---
kernel/events/core.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4100,7 +4100,7 @@ perf_adjust_freq_unthr_context(struct pe
if (!(ctx->nr_freq || unthrottle))
return;
- raw_spin_lock(&ctx->lock);
+ guard(raw_spinlock)(&ctx->lock);
list_for_each_entry_rcu(event, &ctx->event_list, event_entry) {
if (event->state != PERF_EVENT_STATE_ACTIVE)
@@ -4110,7 +4110,7 @@ perf_adjust_freq_unthr_context(struct pe
if (!event_filter_match(event))
continue;
- perf_pmu_disable(event->pmu);
+ guard(perf_pmu_disable)(event->pmu);
hwc = &event->hw;
@@ -4121,7 +4121,7 @@ perf_adjust_freq_unthr_context(struct pe
}
if (!event->attr.freq || !event->attr.sample_freq)
- goto next;
+ continue;
/*
* stop the event and update event->count
@@ -4143,11 +4143,7 @@ perf_adjust_freq_unthr_context(struct pe
perf_adjust_period(event, period, delta, false);
event->pmu->start(event, delta > 0 ? PERF_EF_RELOAD : 0);
- next:
- perf_pmu_enable(event->pmu);
}
-
- raw_spin_unlock(&ctx->lock);
}
/*
More information about the Linux-security-module-archive
mailing list