Skip to content

Commit 823beb3

Browse files
James Morsebp3tk0v
authored andcommitted
x86/resctrl: Move get_{mon,ctrl}_domain_from_cpu() to live with their callers
Each of get_{mon,ctrl}_domain_from_cpu() only has one caller. Once the filesystem code is moved to /fs/, there is no equivalent to core.c. Move these functions to each live next to their caller. This allows them to be made static and the header file entries to be removed. Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Fenghua Yu <fenghuay@nvidia.com> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Reviewed-by: Babu Moger <babu.moger@amd.com> Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Tested-by: Peter Newman <peternewman@google.com> Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Tested-by: Amit Singh Tomar <amitsinght@marvell.com> # arm64 Tested-by: Shanker Donthineni <sdonthineni@nvidia.com> # arm64 Tested-by: Babu Moger <babu.moger@amd.com> Link: https://lore.kernel.org/r/20250311183715.16445-31-james.morse@arm.com
1 parent f62b4e4 commit 823beb3

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

arch/x86/kernel/cpu/resctrl/core.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -347,36 +347,6 @@ static void cat_wrmsr(struct msr_param *m)
347347
wrmsrl(hw_res->msr_base + i, hw_dom->ctrl_val[i]);
348348
}
349349

350-
struct rdt_ctrl_domain *get_ctrl_domain_from_cpu(int cpu, struct rdt_resource *r)
351-
{
352-
struct rdt_ctrl_domain *d;
353-
354-
lockdep_assert_cpus_held();
355-
356-
list_for_each_entry(d, &r->ctrl_domains, hdr.list) {
357-
/* Find the domain that contains this CPU */
358-
if (cpumask_test_cpu(cpu, &d->hdr.cpu_mask))
359-
return d;
360-
}
361-
362-
return NULL;
363-
}
364-
365-
struct rdt_mon_domain *get_mon_domain_from_cpu(int cpu, struct rdt_resource *r)
366-
{
367-
struct rdt_mon_domain *d;
368-
369-
lockdep_assert_cpus_held();
370-
371-
list_for_each_entry(d, &r->mon_domains, hdr.list) {
372-
/* Find the domain that contains this CPU */
373-
if (cpumask_test_cpu(cpu, &d->hdr.cpu_mask))
374-
return d;
375-
}
376-
377-
return NULL;
378-
}
379-
380350
u32 resctrl_arch_get_num_closid(struct rdt_resource *r)
381351
{
382352
return resctrl_to_arch_res(r)->num_closid;

arch/x86/kernel/cpu/resctrl/internal.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,6 @@ unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r, struct rdt_ctrl_domain
475475
unsigned long cbm);
476476
enum rdtgrp_mode rdtgroup_mode_by_closid(int closid);
477477
int rdtgroup_tasks_assigned(struct rdtgroup *r);
478-
struct rdt_ctrl_domain *get_ctrl_domain_from_cpu(int cpu, struct rdt_resource *r);
479-
struct rdt_mon_domain *get_mon_domain_from_cpu(int cpu, struct rdt_resource *r);
480478
int closids_supported(void);
481479
void closid_free(int closid);
482480
int alloc_rmid(u32 closid);

arch/x86/kernel/cpu/resctrl/monitor.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,22 @@ void mon_event_count(void *info)
718718
rr->err = 0;
719719
}
720720

721+
static struct rdt_ctrl_domain *get_ctrl_domain_from_cpu(int cpu,
722+
struct rdt_resource *r)
723+
{
724+
struct rdt_ctrl_domain *d;
725+
726+
lockdep_assert_cpus_held();
727+
728+
list_for_each_entry(d, &r->ctrl_domains, hdr.list) {
729+
/* Find the domain that contains this CPU */
730+
if (cpumask_test_cpu(cpu, &d->hdr.cpu_mask))
731+
return d;
732+
}
733+
734+
return NULL;
735+
}
736+
721737
/*
722738
* Feedback loop for MBA software controller (mba_sc)
723739
*

arch/x86/kernel/cpu/resctrl/rdtgroup.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4257,6 +4257,22 @@ static void clear_childcpus(struct rdtgroup *r, unsigned int cpu)
42574257
}
42584258
}
42594259

4260+
static struct rdt_mon_domain *get_mon_domain_from_cpu(int cpu,
4261+
struct rdt_resource *r)
4262+
{
4263+
struct rdt_mon_domain *d;
4264+
4265+
lockdep_assert_cpus_held();
4266+
4267+
list_for_each_entry(d, &r->mon_domains, hdr.list) {
4268+
/* Find the domain that contains this CPU */
4269+
if (cpumask_test_cpu(cpu, &d->hdr.cpu_mask))
4270+
return d;
4271+
}
4272+
4273+
return NULL;
4274+
}
4275+
42604276
void resctrl_offline_cpu(unsigned int cpu)
42614277
{
42624278
struct rdt_resource *l3 = resctrl_arch_get_resource(RDT_RESOURCE_L3);

0 commit comments

Comments
 (0)