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

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
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -397,13 +397,11 @@ 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);
}
}

/* CPUMF <-> perf event mappings for kernel+userspace (basic set) */
static const int cpumf_generic_events_basic[] = {