Skip to content

Commit

Permalink
perf, x86: Properly account n_added
Browse files Browse the repository at this point in the history
Make sure n_added is properly accounted so that we can rely on the value
to reflect the number of added counters. This is needed if its going to
be used for more than a boolean check.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Mar 10, 2010
1 parent 71e2d28 commit 356e1f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/x86/kernel/cpu/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ static int x86_pmu_enable(struct perf_event *event)
memcpy(cpuc->assign, assign, n*sizeof(int));

cpuc->n_events = n;
cpuc->n_added = n - n0;
cpuc->n_added += n - n0;

return 0;
}
Expand Down Expand Up @@ -1302,7 +1302,7 @@ int hw_perf_group_sched_in(struct perf_event *leader,
memcpy(cpuc->assign, assign, n0*sizeof(int));

cpuc->n_events = n0;
cpuc->n_added = n1;
cpuc->n_added += n1;
ctx->nr_active += n1;

/*
Expand Down

0 comments on commit 356e1f2

Please sign in to comment.