]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/resctrl: Reduce L2 impact on CAT test
authorReinette Chatre <reinette.chatre@intel.com>
Sat, 4 Apr 2026 01:56:09 +0000 (18:56 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 5 May 2026 00:40:02 +0000 (18:40 -0600)
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.

Link: https://lore.kernel.org/r/1f5aad318889cd6d4f9a8d8b0fbe83e3848d41a9.1775266384.git.reinette.chatre@intel.com
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Tested-by: Chen Yu <yu.c.chen@intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/resctrl/cat_test.c

index 6aac03147d411804832b153fa07125672267f2da..371a2f26dc47b1f2b5d4bb0e1b42191d9cc897f6 100644 (file)
@@ -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) {