lkml.org 
[lkml]   [2021]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 01/24] x86/resctrl: Split struct rdt_resource
Date
Hi Reinette,

On 17/11/2020 19:20, Reinette Chatre wrote:
> On 10/30/2020 9:10 AM, James Morse wrote:
>> Splitting rdt_domain up in a similar way happens in the next patch.
>> No change in behaviour, this patch just moves types around.
>
> Please remove the "this patch" term.

>> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
>> index e5f4ee8f4c3b..470661f2eb68 100644
>> --- a/arch/x86/kernel/cpu/resctrl/core.c
>> +++ b/arch/x86/kernel/cpu/resctrl/core.c

>> @@ -912,9 +938,14 @@ static __init bool get_rdt_resources(void)
>>     static __init void rdt_init_res_defs_intel(void)
>>   {
>> +    struct rdt_hw_resource *hw_res;
>>       struct rdt_resource *r;
>> +    int i;
>> +
>> +    for (i = 0; i < RDT_NUM_RESOURCES; i++) {
>> +        hw_res = &rdt_resources_all[i];
>> +        r = &rdt_resources_all[i].resctrl;
>>   -    for_each_rdt_resource(r) {
>>           if (r->rid == RDT_RESOURCE_L3 ||
>>               r->rid == RDT_RESOURCE_L3DATA ||
>>               r->rid == RDT_RESOURCE_L3CODE ||
>
> Could using for_each_rdt_resource() remain with the additional assignment of hw_res?
> Similar to the later usage of for_each_alloc_enabled_rdt_resource()?

Sure. I didn't do it here because of the back-to-back container_of(), even though the
array is defined in the same file. But the compiler will remove all of that.


>> diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
>> b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
>> index c877642e8a14..ab6e584c9d2d 100644
>> --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
>> +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
>> @@ -284,10 +284,12 @@ int update_domains(struct rdt_resource *r, int closid)
>>   static int rdtgroup_parse_resource(char *resname, char *tok,
>>                      struct rdtgroup *rdtgrp)
>>   {
>> +    struct rdt_hw_resource *hw_res;
>>       struct rdt_resource *r;
>>         for_each_alloc_enabled_rdt_resource(r) {
>> -        if (!strcmp(resname, r->name) && rdtgrp->closid < r->num_closid)
>> +        hw_res = resctrl_to_arch_res(r);
>> +        if (!strcmp(resname, r->name) && rdtgrp->closid < hw_res->num_closid)
>>               return parse_line(tok, r, rdtgrp);
>>       }

> This is the usage of for_each_alloc_enabled_rdt_resource() I refer to earlier.

(if it helps, the difference in treatment is because this one is to do with the filesystem
interface, the others were clearly arch code)


Thanks,

James

\
 
 \ /
  Last update: 2021-03-12 18:11    [W:0.096 / U:0.672 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site