Commit 1ce357cb authored by Thomas Richter's avatar Thomas Richter Committed by Heiko Carstens

s390/cpum_cf: simplify hw_perf_event_destroy()

To remove an event from the CPU Measurement counter facility
use the lock/unlock scheme as done in event creation. Remove
the atomic_add_unless function to make the code easier.
Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
Acked-by: default avatarHendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 7a725b77
...@@ -397,12 +397,10 @@ static DEFINE_MUTEX(pmc_reserve_mutex); ...@@ -397,12 +397,10 @@ static DEFINE_MUTEX(pmc_reserve_mutex);
/* Release the PMU if event is the last perf event */ /* Release the PMU if event is the last perf event */
static void hw_perf_event_destroy(struct perf_event *event) static void hw_perf_event_destroy(struct perf_event *event)
{ {
if (!atomic_add_unless(&num_events, -1, 1)) { mutex_lock(&pmc_reserve_mutex);
mutex_lock(&pmc_reserve_mutex); if (atomic_dec_return(&num_events) == 0)
if (atomic_dec_return(&num_events) == 0) __kernel_cpumcf_end();
__kernel_cpumcf_end(); mutex_unlock(&pmc_reserve_mutex);
mutex_unlock(&pmc_reserve_mutex);
}
} }
/* CPUMF <-> perf event mappings for kernel+userspace (basic set) */ /* CPUMF <-> perf event mappings for kernel+userspace (basic set) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment