Re: [PATCH v3 10/10] selftests/resctrl: Reduce L2 impact on CAT test
From: Reinette Chatre
Date: Fri Mar 27 2026 - 19:24:46 EST
Hi Ilpo,
On 3/27/26 10:49 AM, Ilpo Järvinen wrote:
> On Fri, 13 Mar 2026, Reinette Chatre wrote:
>
>> The L3 CAT test loads a buffer into cache that is proportional to the L3
>> size allocated for the workload and measures cache misses when accessing
>> the buffer as a test of L3 occupancy. When loading the buffer it can be
>> assumed that a portion of the buffer will be loaded into the L2 cache and
>> depending on cache design may not be present in L3. It is thus possible
>> for data to not be in L3 but also not trigger an L3 cache miss when
>> accessed.
>>
>> Reduce impact of L2 on the L3 CAT test by, if L2 allocation is supported,
>> minimizing the portion of L2 that the workload can allocate into. This
>> encourages most of buffer to be loaded into L3 and support better
>> comparison between buffer size, cache portion, and cache misses when
>> accessing the buffer.
>>
>> Signed-off-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
>> Tested-by: Chen Yu <yu.c.chen@xxxxxxxxx>
>> ---
>> Changes since v2:
>> - Add Chen Yu's tag.
>> ---
>> tools/testing/selftests/resctrl/cat_test.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c
>> index 6aac03147d41..371a2f26dc47 100644
>> --- a/tools/testing/selftests/resctrl/cat_test.c
>> +++ b/tools/testing/selftests/resctrl/cat_test.c
>> @@ -157,6 +157,10 @@ static int cat_test(const struct resctrl_test *test,
>> if (ret)
>> goto reset_affinity;
>>
>> + ret = minimize_l2_occupancy(test, uparams, param);
>> + if (ret)
>> + goto reset_affinity;
>> +
>> perf_event_attr_initialize(&pea, PERF_COUNT_HW_CACHE_MISSES);
>> pe_fd = perf_open(&pea, bm_pid, uparams->cpu);
>> if (pe_fd < 0) {
>>
>
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
>
Thank you very much for this and all the other reviews. Much appreciated.
Reinette