From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423673AbcBQSGO (ORCPT ); Wed, 17 Feb 2016 13:06:14 -0500 Received: from mga02.intel.com ([134.134.136.20]:57799 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423565AbcBQSGK (ORCPT ); Wed, 17 Feb 2016 13:06:10 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,461,1449561600"; d="scan'208";a="915033636" Date: Wed, 17 Feb 2016 10:04:04 -0800 From: Jacob Pan To: Thomas Gleixner Cc: "Rafael J. Wysocki" , Peter Zijlstra , LKML , Linux PM , Rafael Wysocki , Srinivas Pandruvada , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH v3] powercap/rapl: reduce ipi calls Message-ID: <20160217100404.5a59649a@icelake> In-Reply-To: References: <1452884653-10560-1-git-send-email-jacob.jun.pan@linux.intel.com> <4100978.ozoN0XeYQl@vostro.rjw.lan> Organization: OTC X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 17 Feb 2016 17:04:41 +0100 (CET) Thomas Gleixner wrote: > > > > > > for_each_online_cpu(i) { > > > if (topology_physical_package_id(i) == > > > package_id) > > This is still crap. We really want a proper handling for that which > does not require these silly for_each_cpu() loops. > > That code already has a hotplug notifier, so you can track one online > cpu in the package like we do in cqm and other facilities. > > The first online cpu of a package sets itself as 'owner'. On unplug > it looks up: > > rpl->cpu = cpumask_any_but(topology_core_cpumask(cpu), cpu); > > So if this is the last cpu then rpl->cpu becomes nr_cpu_ids. > > So that whole nonsense can be avoided completely. ok, that would work nicely, similar to cqm_pick_event_reader(). thanks for the tip. just fyi, unlike perf cqm, rapl runtime change is expected to be low frequency.