From nobody Fri Feb 13 07:32:12 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C80617CA09 for ; Fri, 31 May 2024 19:57:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717185456; cv=none; b=CGEGqiJVyGcc7YFyIoX08SfaT3ltTZrt29RgD5QGkfSSqWSDHNdZ77rP9X2fJgCrnRELNsEW7VMR5U9GtGAD5dYTYSoAv2/Yf+m35Sy2F0uJ/Lqva31sK3ubsnaIpEpmhbA8r0svPG40MApa/aXtdJsW6iV5H4SA17T7wlWag6U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717185456; c=relaxed/simple; bh=RsqO07LtaR/1pQ294RLwenEBg2L8jtETbGsARD5fAjo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fl4tkIPqfLxwwesXQL4BErp29qriyskuCGPkirgTrZ8zaqQQ0Fb8NUyfzviBO85Wk7ryUcLH6wCazNZEycTdKdXOSBiol7KPken9pdXOHR3P1qSMJyFo0Vtx8n2aMYLa6+8PDPrXA4FhAGO0nESfA+JSD4+rlTr6lsNLP41+2Vg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ZJKlGeh2; arc=none smtp.client-ip=192.198.163.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZJKlGeh2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717185455; x=1748721455; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RsqO07LtaR/1pQ294RLwenEBg2L8jtETbGsARD5fAjo=; b=ZJKlGeh21J6/yGuI58Pxh+Tkd7vnoEwCxXprd4CMeslZinmxkyo0uvH+ pnaLPG8B9RWDq2y675QqDdieg96pW5qycCMLtrpSa8pgLaLm3CKc8eabY pu9NGTMGrjGkyWaRsHT5NIQB/N1q2k5lGfz1BBYg2UAklgkyJfzqK+Po5 qGDn/Mjs1y8xaFAWku8f4AdckrUmXBdwZot4dV8TnLTO9cQmHc47+QLt1 ba7yttIp1NKELUomcsMwhkV2fc0+PlinAfgoYrrbLq+Gb5FnJ02v7BzCU /rVYHdwub1qwyqfpJnZCuGIECqiRc6sQHlIkOyID8LX5IIRBuSDAs4isu Q==; X-CSE-ConnectionGUID: XbLATo1ITHCowp7eofFzGQ== X-CSE-MsgGUID: p+iOPmpsTCu1pIdV+TC4vg== X-IronPort-AV: E=McAfee;i="6600,9927,11089"; a="13501146" X-IronPort-AV: E=Sophos;i="6.08,205,1712646000"; d="scan'208";a="13501146" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2024 12:57:33 -0700 X-CSE-ConnectionGUID: KoVO3zmHRBm5PSLOFDbLfA== X-CSE-MsgGUID: /Lt1zt62TxGKKJVhQXyUeg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,205,1712646000"; d="scan'208";a="59438873" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2024 12:57:32 -0700 From: Tony Luck To: Greg Kroah-Hartman , Andrew Morton , Thomas Gleixner , Borislav Petkov Cc: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH 2/3] x86/resctrl: Replace open code cacheinfo search in pseudo_lock_region_init() Date: Fri, 31 May 2024 12:57:19 -0700 Message-ID: <20240531195720.232561-3-tony.luck@intel.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240531195720.232561-1-tony.luck@intel.com> References: <20240531195720.232561-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use get_cpu_cacheinfo_level() instead of open coded search. Signed-off-by: Tony Luck Reviewed-by: Reinette Chatre --- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c b/arch/x86/kernel/cp= u/resctrl/pseudo_lock.c index aacf236dfe3b..1bbfd3c1e300 100644 --- a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c +++ b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c @@ -292,9 +292,8 @@ static void pseudo_lock_region_clear(struct pseudo_lock= _region *plr) */ static int pseudo_lock_region_init(struct pseudo_lock_region *plr) { - struct cpu_cacheinfo *ci; + struct cacheinfo *ci; int ret; - int i; =20 /* Pick the first cpu we find that is associated with the cache. */ plr->cpu =3D cpumask_first(&plr->d->cpu_mask); @@ -306,15 +305,11 @@ static int pseudo_lock_region_init(struct pseudo_lock= _region *plr) goto out_region; } =20 - ci =3D get_cpu_cacheinfo(plr->cpu); - - plr->size =3D rdtgroup_cbm_to_size(plr->s->res, plr->d, plr->cbm); - - for (i =3D 0; i < ci->num_leaves; i++) { - if (ci->info_list[i].level =3D=3D plr->s->res->cache_level) { - plr->line_size =3D ci->info_list[i].coherency_line_size; - return 0; - } + ci =3D get_cpu_cacheinfo_level(plr->cpu, plr->s->res->cache_level); + if (ci) { + plr->line_size =3D ci->coherency_line_size; + plr->size =3D rdtgroup_cbm_to_size(plr->s->res, plr->d, plr->cbm); + return 0; } =20 ret =3D -1; --=20 2.45.0