[LTP] perf_event_open03.c:95: TFAIL: Likely kernel memory leak detected
Li Wang
liwang@redhat.com
Mon Jul 1 13:37:30 CEST 2024
Hi Martin, All,
Our automatic jobs keep throwing thus false positives on the daily test.
After checking perf_event_open03.c, it uses the diff of MemAvailable as the
final condition for memory leaks.
perf_event_open03.c:95: TFAIL: Likely kernel memory leak detected
I think relying solely on the MemAvailable metric to detect a memory leak
can be imprecise, because available memory can be influenced by various
factors unrelated to the specific code being tested.
And "/sys/kernel/debug/kmemleak" maybe a good tool for diagnosing memory
leak,
but it is usually disabled on the stock kernel by default, so far I have no
better idea
how to improve that, any suggestions?
diff = SAFE_READ_MEMINFO("MemAvailable:");
/* leak about 100MB of RAM */
for (i = 0; i < iterations; i++) {
ioctl(fd, PERF_EVENT_IOC_SET_FILTER, "filter,0/0@abcd");
check_progress(i);
}
diff -= SAFE_READ_MEMINFO("MemAvailable:");
if (diff > 50 * 1024)
tst_res(TFAIL, "Likely kernel memory leak detected");
...
--
Regards,
Li Wang
More information about the ltp
mailing list