public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: LTP List <ltp@lists.linux.it>
Subject: Re: [LTP] perf_event_open03.c:95: TFAIL: Likely kernel memory leak detected
Date: Mon, 1 Jul 2024 14:10:59 +0200	[thread overview]
Message-ID: <ZoKc03XnRNQJY4bs@yuki> (raw)
In-Reply-To: <CAEemH2cDCEW_akeKDECceW_5+B1z+Vw0gpRiC-upePn3tPauLQ@mail.gmail.com>

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2024-07-01 12:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01 11:37 [LTP] perf_event_open03.c:95: TFAIL: Likely kernel memory leak detected Li Wang
2024-07-01 12:10 ` Cyril Hrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZoKc03XnRNQJY4bs@yuki \
    --to=chrubis@suse.cz \
    --cc=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox