lkml.org 
[lkml]   [2015]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 08/10] perf/x86: Remove pointless tests
Both intel_commit_scheduling() and intel_get_excl_contraints() test
for cntr < 0.

The only way that can happen (aside from a bug) is through
validate_event(), however that is already captured by the
cpuc->is_fake test.

So remove these test and simplify the code.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
arch/x86/kernel/cpu/perf_event_intel.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)

--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1955,12 +1955,10 @@ static void intel_commit_scheduling(stru

lockdep_assert_held(&excl_cntrs->lock);

- if (cntr >= 0) {
- if (c->flags & PERF_X86_EVENT_EXCL)
- xl->init_state[cntr] = INTEL_EXCL_EXCLUSIVE;
- else
- xl->init_state[cntr] = INTEL_EXCL_SHARED;
- }
+ if (c->flags & PERF_X86_EVENT_EXCL)
+ xl->init_state[cntr] = INTEL_EXCL_EXCLUSIVE;
+ else
+ xl->init_state[cntr] = INTEL_EXCL_SHARED;
}

static void
@@ -2028,10 +2026,6 @@ intel_get_excl_constraints(struct cpu_hw
if (!(c->flags & PERF_X86_EVENT_DYNAMIC)) {
struct event_constraint *cx;

- /* sanity check */
- if (idx < 0)
- return &emptyconstraint;
-
/*
* grab pre-allocated constraint entry
*/



\
 
 \ /
  Last update: 2015-05-21 13:41    [W:0.668 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site