From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753057AbcD2Eqi (ORCPT ); Fri, 29 Apr 2016 00:46:38 -0400 Received: from mail-pf0-f174.google.com ([209.85.192.174]:35625 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752992AbcD2Eqd (ORCPT ); Fri, 29 Apr 2016 00:46:33 -0400 From: David Carrillo-Cisneros To: Peter Zijlstra , Alexander Shishkin , Arnaldo Carvalho de Melo , Ingo Molnar Cc: Vikas Shivappa , Matt Fleming , Tony Luck , Stephane Eranian , Paul Turner , David Carrillo-Cisneros , x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 14/32] perf/x86/intel/cqm: add preallocation of anodes Date: Thu, 28 Apr 2016 21:43:20 -0700 Message-Id: <1461905018-86355-15-git-send-email-davidcc@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1461905018-86355-1-git-send-email-davidcc@google.com> References: <1461905018-86355-1-git-send-email-davidcc@google.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pre-allocate enough anodes to be able to at least hold one set of RMIDs per package before running out of anodes. Reviewed-by: Stephane Eranian Signed-off-by: David Carrillo-Cisneros --- arch/x86/events/intel/cqm.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/events/intel/cqm.c b/arch/x86/events/intel/cqm.c index 904f2d3..98a919f 100644 --- a/arch/x86/events/intel/cqm.c +++ b/arch/x86/events/intel/cqm.c @@ -194,6 +194,7 @@ static int anode_pool__alloc_one(u16 pkg_id); /* Init cqm pkg_data for @cpu 's package. */ static int pkg_data_init_cpu(int cpu) { + int i, nr_anodes; struct pkg_data *pkg_data; struct cpuinfo_x86 *c = &cpu_data(cpu); u16 pkg_id = topology_physical_package_id(cpu); @@ -257,6 +258,15 @@ static int pkg_data_init_cpu(int cpu) pkg_data->timed_update_cpu = cpu; cqm_pkgs_data[pkg_id] = pkg_data; + + /* Pre-allocate pool with one anode more than minimum needed to contain + * all the RMIDs in the package. + */ + nr_anodes = (pkg_data->max_rmid + NR_RMIDS_PER_NODE) / + NR_RMIDS_PER_NODE + 1; + + for (i = 0; i < nr_anodes; i++) + anode_pool__alloc_one(pkg_id); return 0; } -- 2.8.0.rc3.226.g39d4020