Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147425
b: refs/heads/master
c: ba77813
h: refs/heads/master
i:
  147423: 26ac0b5
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed May 4, 2009
1 parent e7d4f6e commit e27bb4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b82914ce33146186d554b0f5c41e4e13693614ce
refs/heads/master: ba77813a2a22d631fe5bc0bf1ec0d11350544b70
14 changes: 7 additions & 7 deletions trunk/arch/x86/kernel/cpu/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ x86_perf_counter_update(struct perf_counter *counter,
return new_raw_count;
}

static atomic_t num_counters;
static atomic_t active_counters;
static DEFINE_MUTEX(pmc_reserve_mutex);

static bool reserve_pmc_hardware(void)
Expand Down Expand Up @@ -224,7 +224,7 @@ static void release_pmc_hardware(void)

static void hw_perf_counter_destroy(struct perf_counter *counter)
{
if (atomic_dec_and_mutex_lock(&num_counters, &pmc_reserve_mutex)) {
if (atomic_dec_and_mutex_lock(&active_counters, &pmc_reserve_mutex)) {
release_pmc_hardware();
mutex_unlock(&pmc_reserve_mutex);
}
Expand All @@ -248,12 +248,12 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
return -ENODEV;

err = 0;
if (atomic_inc_not_zero(&num_counters)) {
if (!atomic_inc_not_zero(&active_counters)) {
mutex_lock(&pmc_reserve_mutex);
if (atomic_read(&num_counters) == 0 && !reserve_pmc_hardware())
if (atomic_read(&active_counters) == 0 && !reserve_pmc_hardware())
err = -EBUSY;
else
atomic_inc(&num_counters);
atomic_inc(&active_counters);
mutex_unlock(&pmc_reserve_mutex);
}
if (err)
Expand All @@ -280,7 +280,7 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
if (capable(CAP_SYS_ADMIN) && hw_event->nmi)
hwc->nmi = 1;

hwc->irq_period = hw_event->irq_period;
hwc->irq_period = hw_event->irq_period;
if ((s64)hwc->irq_period <= 0 || hwc->irq_period > x86_pmu.max_period)
hwc->irq_period = x86_pmu.max_period;

Expand Down Expand Up @@ -871,7 +871,7 @@ perf_counter_nmi_handler(struct notifier_block *self,
struct pt_regs *regs;
int ret;

if (!atomic_read(&num_counters))
if (!atomic_read(&active_counters))
return NOTIFY_DONE;

switch (cmd) {
Expand Down

0 comments on commit e27bb4d

Please sign in to comment.