Re: [RFC PATCH v2 02/10] arm_mpam: resctrl: Rename ctrl_comp in mpam_resctrl_alloc_domain()

From: Reinette Chatre

Date: Fri Oct 23 2026 - 10:59:52 EST




On 10/23/26 1:08 AM, Jinjie Ruan wrote:
>
>
> 在 2026/10/20 6:07, Reinette Chatre 写道:
>> mpam_resctrl_alloc_domain() looks up the component of the resource's
>> class that contains the CPU and fails the domain allocation if there is
>> none. The component is held in a local variable named ctrl_comp and, when
>> the resource supports allocation, it also backs the control domain.
>>
>> The lookup and its check apply to every resource, including one that
>> supports only monitoring. For such a resource the component does not
>> back a control domain, so the name ctrl_comp is misleading. The name also
>> makes a comment in the same function ambiguous. The comment notes that
>> there may be no ctrl_comp for the L3, which is true of the control
>> domain's component but contradicts the local variable, which always
>> refers to a component once the lookup succeeds.
>>
>> Rename the local variable to comp. Keep the ctrl_comp name for the
>> control domain's reference to its component because it only ever refers
>> to the component that backs the control domain. Leave the comment
>> unchanged since it now unambiguously refers to that component.
>>
>> No functional change.
>>
>> Signed-off-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
>> ---
>> drivers/resctrl/mpam_resctrl.c | 10 +++++-----
>> 1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
>> index 3d5f90f9f1f3..b07e5dd895dd 100644
>> --- a/drivers/resctrl/mpam_resctrl.c
>> +++ b/drivers/resctrl/mpam_resctrl.c
>> @@ -1623,14 +1623,14 @@ mpam_resctrl_alloc_domain(unsigned int cpu, struct mpam_resctrl_res *res)
>> struct rdt_l3_mon_domain *mon_d;
>> struct rdt_ctrl_domain *ctrl_d;
>> struct mpam_class *class = res->class;
>> - struct mpam_component *ctrl_comp;
>> + struct mpam_component *comp;
>> struct rdt_resource *r = &res->resctrl_res;
>
> Reviewed-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
>
Thank you very much.

Reinette