The patch titled Subject: x86/resctrl: replace open code cacheinfo search in rdtgroup_cbm_to_size() has been added to the -mm mm-nonmm-unstable branch. Its filename is x86-resctrl-replace-open-code-cacheinfo-search-in-rdtgroup_cbm_to_size.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/x86-resctrl-replace-open-code-cacheinfo-search-in-rdtgroup_cbm_to_size.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Tony Luck <tony.luck@xxxxxxxxx> Subject: x86/resctrl: replace open code cacheinfo search in rdtgroup_cbm_to_size() Date: Fri, 31 May 2024 12:57:20 -0700 Use get_cpu_cacheinfo_level() instead of open coded search. Link: https://lkml.kernel.org/r/20240531195720.232561-4-tony.luck@xxxxxxxxx Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx> Cc: Babu Moger <babu.moger@xxxxxxx> Cc: Borislav Petkov (AMD) <bp@xxxxxxxxx> Cc: Dave Martin <Dave.Martin@xxxxxxx> Cc: Drew Fustini <dfustini@xxxxxxxxxxxx> Cc: Fenghua Yu <fenghua.yu@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: James Morse <james.morse@xxxxxxx> Cc: Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx> Cc: Peter Newman <peternewman@xxxxxxxxxx> Cc: Reinette Chatre <reinette.chatre@xxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c~x86-resctrl-replace-open-code-cacheinfo-search-in-rdtgroup_cbm_to_size +++ a/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1450,18 +1450,14 @@ out: unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r, struct rdt_domain *d, unsigned long cbm) { - struct cpu_cacheinfo *ci; + struct cacheinfo *ci; unsigned int size = 0; - int num_b, i; + int num_b; num_b = bitmap_weight(&cbm, r->cache.cbm_len); - ci = get_cpu_cacheinfo(cpumask_any(&d->cpu_mask)); - for (i = 0; i < ci->num_leaves; i++) { - if (ci->info_list[i].level == r->cache_level) { - size = ci->info_list[i].size / r->cache.cbm_len * num_b; - break; - } - } + ci = get_cpu_cacheinfo_level(cpumask_any(&d->cpu_mask), r->cache_level); + if (ci) + size = ci->size / r->cache.cbm_len * num_b; return size; } _ Patches currently in -mm which might be from tony.luck@xxxxxxxxx are cacheinfo-add-function-to-get-cacheinfo-for-a-given-cpu-cachelevel.patch x86-resctrl-replace-open-code-cacheinfo-search-in-pseudo_lock_region_init.patch x86-resctrl-replace-open-code-cacheinfo-search-in-rdtgroup_cbm_to_size.patch