Re: [PATCH v5 8/8] selftests/resctrl: Adjust effective L3 cache size when SNC enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023-09-07 at 16:19:37 +0000, Luck, Tony wrote:
>> > +   if (4 * node_cpus >= cache_cpus)
>> > +           return 4;
>> > +   else if (2 * node_cpus >= cache_cpus)
>> > +           return 2;
>>
>>
>> If "4 * node_cpus >= cache_cpus " is not true,
>> "2 * node_cpus >= cache_cpus" will never be true.
>> Is it the following code?
>>
>> +     if (2 * node_cpus >= cache_cpus)
>> +             return 2;
>> +     else if (4 * node_cpus >= cache_cpus)
>> +             return 4;
>
>
>Shaopeng TAN,
>
>Good catch. Your solution is the correct one.
>
>Will fix in next post.

I played around with this code a little and I think the logical
expressions are returning wrong values.

On a system that has SNC disabled the function reports both "node_cpus"
and "cache_cpus" equal to 56. In this case snc_ways() returns "2". It is
the same on a system with SNC enabled that reports the previously mentioned
variables to be different by a factor of two (36 and 72).

Is it possible for node_cpus and cache_cpus to not be multiples of each
other? (as in for example cache_cpus being 10 and node_cpus being 21?).
If not I'd suggest using "==" instead of ">=".

If yes then I guess something like this could work? :

+     if (node_cpus >= cache_cpus)
+             return 1;
+     else if (2 * node_cpus >= cache_cpus)
+             return 2;
+     else if (4 * node_cpus >= cache_cpus)
+             return 4;

PS. I did my tests on two Intel Ice Lakes.

-- 
Kind regards
Maciej Wieczór-Retman



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux