From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752228AbdARMMR (ORCPT ); Wed, 18 Jan 2017 07:12:17 -0500 Received: from foss.arm.com ([217.140.101.70]:49854 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751444AbdARMMP (ORCPT ); Wed, 18 Jan 2017 07:12:15 -0500 Date: Wed, 18 Jan 2017 12:11:13 +0000 From: Mark Rutland To: David Carrillo-Cisneros Cc: linux-kernel@vger.kernel.org, "x86@kernel.org" , Ingo Molnar , Thomas Gleixner , Andi Kleen , Kan Liang , Peter Zijlstra , Borislav Petkov , Srinivas Pandruvada , Dave Hansen , Vikas Shivappa , Arnaldo Carvalho de Melo , Vince Weaver , Paul Turner , Stephane Eranian Subject: Re: [PATCH 1/2] perf/core: Make cgroup switch visit only cpuctxs with cgroup events Message-ID: <20170118121113.GC3231@leverpostej> References: <20170117173840.10614-1-davidcc@google.com> <20170117173840.10614-2-davidcc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170117173840.10614-2-davidcc@google.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 17, 2017 at 09:38:39AM -0800, David Carrillo-Cisneros wrote: > This is a low-hanging fruit optimization. It replaces the iteration over > the "pmus" list in cgroup switch by an iteration over a new list that > contains only cpuctxs with at least one cgroup event. > > This is necessary because the number of pmus have increased over the years > e.g modern x86 server systems have well above 50 pmus. > The iteration over the full pmu list is unneccessary and can be costly in > heavy cache contention scenarios. While I haven't done any measurement of the overhead, this looks like a nice rework/cleanup. Since this is only changing the management of cpu contexts, this shouldn't adversely affect systems with heterogeneous CPUs. I've also given this a spin on such a system, to no ill effect. I have one (very minor) comment below, but either way: Acked-by: Mark Rutland Tested-by: Mark Rutland > @@ -889,6 +876,7 @@ list_update_cgroup_event(struct perf_event *event, > struct perf_event_context *ctx, bool add) > { > struct perf_cpu_context *cpuctx; > + struct list_head *lentry; It might be worth calling this cpuctx_entry, so that it's clear which list element it refers to. I can imagine we'll add more list manipulation in this path in future. Thanks, Mark.