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: Thomas Richter <tmricht@linux.ibm.com> Acked-by: Hendrik Brueckner <brueckner@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
7a725b7702
commit
1ce357cb82
|
@ -397,12 +397,10 @@ static DEFINE_MUTEX(pmc_reserve_mutex);
|
|||
/* Release the PMU if event is the last perf event */
|
||||
static void hw_perf_event_destroy(struct perf_event *event)
|
||||
{
|
||||
if (!atomic_add_unless(&num_events, -1, 1)) {
|
||||
mutex_lock(&pmc_reserve_mutex);
|
||||
if (atomic_dec_return(&num_events) == 0)
|
||||
__kernel_cpumcf_end();
|
||||
mutex_unlock(&pmc_reserve_mutex);
|
||||
}
|
||||
mutex_lock(&pmc_reserve_mutex);
|
||||
if (atomic_dec_return(&num_events) == 0)
|
||||
__kernel_cpumcf_end();
|
||||
mutex_unlock(&pmc_reserve_mutex);
|
||||
}
|
||||
|
||||
/* CPUMF <-> perf event mappings for kernel+userspace (basic set) */
|
||||
|
|
Loading…
Reference in New Issue