From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946008AbbEVNdW (ORCPT ); Fri, 22 May 2015 09:33:22 -0400 Received: from casper.infradead.org ([85.118.1.10]:49327 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751161AbbEVNdS (ORCPT ); Fri, 22 May 2015 09:33:18 -0400 Message-Id: <20150522133136.079512913@infradead.org> User-Agent: quilt/0.61-1 Date: Fri, 22 May 2015 15:29:13 +0200 From: Peter Zijlstra To: mingo@kernel.org, peterz@infradead.org Cc: vincent.weaver@maine.edu, eranian@google.com, jolsa@redhat.com, linux-kernel@vger.kernel.org Subject: [PATCH v2 08/11] perf/x86: Remove pointless tests References: <20150522132905.416122812@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=peterz-pmu-sched-7.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) --- 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 */