Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147436
b: refs/heads/master
c: 7fc23a5
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed May 8, 2009
1 parent 9090e15 commit 7b8a404
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 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: 3611dfb8eda847c1c8e1a052f57206f7fddc6a7c
refs/heads/master: 7fc23a5380797012e92a9633169440f2f4a21253
13 changes: 11 additions & 2 deletions trunk/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ int perf_max_counters __read_mostly = 1;
static int perf_reserved_percpu __read_mostly;
static int perf_overcommit __read_mostly = 1;

static atomic_t nr_counters __read_mostly;
static atomic_t nr_mmap_tracking __read_mostly;
static atomic_t nr_munmap_tracking __read_mostly;
static atomic_t nr_comm_tracking __read_mostly;
Expand Down Expand Up @@ -1076,8 +1077,14 @@ static void rotate_ctx(struct perf_counter_context *ctx)

void perf_counter_task_tick(struct task_struct *curr, int cpu)
{
struct perf_cpu_context *cpuctx = &per_cpu(perf_cpu_context, cpu);
struct perf_counter_context *ctx = &curr->perf_counter_ctx;
struct perf_cpu_context *cpuctx;
struct perf_counter_context *ctx;

if (!atomic_read(&nr_counters))
return;

cpuctx = &per_cpu(perf_cpu_context, cpu);
ctx = &curr->perf_counter_ctx;

perf_counter_cpu_sched_out(cpuctx);
perf_counter_task_sched_out(curr, cpu);
Expand Down Expand Up @@ -1197,6 +1204,7 @@ static void free_counter(struct perf_counter *counter)
{
perf_pending_sync(counter);

atomic_dec(&nr_counters);
if (counter->hw_event.mmap)
atomic_dec(&nr_mmap_tracking);
if (counter->hw_event.munmap)
Expand Down Expand Up @@ -2861,6 +2869,7 @@ perf_counter_alloc(struct perf_counter_hw_event *hw_event,

counter->pmu = pmu;

atomic_inc(&nr_counters);
if (counter->hw_event.mmap)
atomic_inc(&nr_mmap_tracking);
if (counter->hw_event.munmap)
Expand Down

0 comments on commit 7b8a404

Please sign in to comment.