perf/x86/intel: Remove division from the intel_pmu_drain_pebs_nhm() hot path
Only do the division in case we have to print the result out in a warning. Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/n/tip-43nl31erfbajwpfj254f6zji@git.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
7f2ee91f54
commit
eb8417aa70
1 changed files with 5 additions and 5 deletions
|
@ -944,7 +944,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
|
||||||
struct perf_event *event = NULL;
|
struct perf_event *event = NULL;
|
||||||
void *at, *top;
|
void *at, *top;
|
||||||
u64 status = 0;
|
u64 status = 0;
|
||||||
int bit, n;
|
int bit;
|
||||||
|
|
||||||
if (!x86_pmu.pebs_active)
|
if (!x86_pmu.pebs_active)
|
||||||
return;
|
return;
|
||||||
|
@ -954,16 +954,16 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
|
||||||
|
|
||||||
ds->pebs_index = ds->pebs_buffer_base;
|
ds->pebs_index = ds->pebs_buffer_base;
|
||||||
|
|
||||||
n = (top - at) / x86_pmu.pebs_record_size;
|
if (unlikely(at > top))
|
||||||
if (n <= 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Should not happen, we program the threshold at 1 and do not
|
* Should not happen, we program the threshold at 1 and do not
|
||||||
* set a reset value.
|
* set a reset value.
|
||||||
*/
|
*/
|
||||||
WARN_ONCE(n > x86_pmu.max_pebs_events,
|
WARN_ONCE(top - at > x86_pmu.max_pebs_events * x86_pmu.pebs_record_size,
|
||||||
"Unexpected number of pebs records %d\n", n);
|
"Unexpected number of pebs records %ld\n",
|
||||||
|
(top - at) / x86_pmu.pebs_record_size);
|
||||||
|
|
||||||
for (; at < top; at += x86_pmu.pebs_record_size) {
|
for (; at < top; at += x86_pmu.pebs_record_size) {
|
||||||
struct pebs_record_nhm *p = at;
|
struct pebs_record_nhm *p = at;
|
||||||
|
|
Loading…
Add table
Reference in a new issue