summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/livepatch/test_klp-call_getpid.c
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2023-12-15 17:05:06 +0200
committerShuah Khan <skhan@linuxfoundation.org>2024-02-13 13:56:44 -0700
commit90a009db09e2b91990df28e47844d44ae0ef9aa8 (patch)
tree695150811645bee8178eeb5d3a001b9eccf1f655 /tools/testing/selftests/livepatch/test_klp-call_getpid.c
parent2892731ec2893252cdbc256a2bd5436b7fd94cf7 (diff)
downloadlinux-stable-90a009db09e2b91990df28e47844d44ae0ef9aa8.tar.gz
linux-stable-90a009db09e2b91990df28e47844d44ae0ef9aa8.tar.bz2
linux-stable-90a009db09e2b91990df28e47844d44ae0ef9aa8.zip
selftests/resctrl: Replace file write with volatile variable
The fill_buf code prevents compiler optimizating the entire read loop away by writing the final value of the variable into a file. While it achieves the goal, writing into a file requires significant amount of work within the innermost test loop and also error handling. A simpler approach is to take advantage of volatile. Writing through a pointer to a volatile variable is enough to prevent compiler from optimizing the write away, and therefore compiler cannot remove the read loop either. Add a volatile 'value_sink' into resctrl_tests.c and make fill_buf to write into it. As a result, the error handling in fill_buf.c can be simplified. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/livepatch/test_klp-call_getpid.c')
0 files changed, 0 insertions, 0 deletions