Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752489AbdHATtU (ORCPT ); Tue, 1 Aug 2017 15:49:20 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:47578 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752440AbdHATtR (ORCPT ); Tue, 1 Aug 2017 15:49:17 -0400 Date: Tue, 1 Aug 2017 21:49:09 +0200 (CEST) From: Thomas Gleixner To: Vikas Shivappa cc: vikas.shivappa@intel.com, x86@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, peterz@infradead.org, ravi.v.shankar@intel.com, tony.luck@intel.com, fenghua.yu@intel.com, eranian@google.com, davidcc@google.com, ak@linux.intel.com, reinette.chatre@intel.com Subject: Re: [PATCH 16/28] x86/intel_rdt: Prepare to add RDT monitor cpus file support In-Reply-To: <1501017287-28083-17-git-send-email-vikas.shivappa@linux.intel.com> Message-ID: References: <1501017287-28083-1-git-send-email-vikas.shivappa@linux.intel.com> <1501017287-28083-17-git-send-email-vikas.shivappa@linux.intel.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 699 Lines: 29 On Tue, 25 Jul 2017, Vikas Shivappa wrote: > /* > * The cached intel_pqr_state is strictly per CPU and can never be > * updated from a remote CPU. Functions which modify the state > @@ -49,6 +47,8 @@ > */ > DEFINE_PER_CPU(struct intel_pqr_state, pqr_state); > > +DEFINE_PER_CPU_READ_MOSTLY(struct intel_pqr_state, rdt_cpu_default); Cacheline wise this is suboptimal. You have to touch two cachelines on each context switch (at least for read). If you make that: struct intel_pqr_state { u32 default_cosid; u32 default_rmid; u32 cur_cosid; u32 cur_rmid; }; DEFINE_PER_CPU(struct intel_pqr_state, pqr_state); then it's all together and you spare one cache line. Thanks, tglx