[LTP] perf_event_open03.c:95: TFAIL: Likely kernel memory leak detected
Cyril Hrubis
chrubis@suse.cz
Mon Jul 1 14:10:59 CEST 2024
Hi!
> 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");
> ...
Hmm, maybe we can sample the MemAvailable a few times, e.g. every 20MB
leaked and fail the test if we found that most samples have increased
the value.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list