From: Cyril Hrubis <chrubis@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] perf_event_open: improve the memory leak detection
Date: Wed, 17 Jul 2024 10:31:19 +0200 [thread overview]
Message-ID: <ZpeBVwXDVbJwLFu7@rei> (raw)
In-Reply-To: <20240705031502.9041-1-liwang@redhat.com>
Hi!
> + /*
> + * Every 1200000 iterations, calculate the difference in memory
> + * availability. If the difference is greater than 10 * 1024 (10MB),
> + * increment the sample counter and log the event.
> + */
> + if ((i % 1200000) == 0) {
> + mem_avail = SAFE_READ_MEMINFO("MemAvailable:");
> + diff = mem_avail_prev - mem_avail;
> + diff_total += diff;
> +
> + if (diff > 20 * 1024) {
Shouldn't this be 10 * 1024 or possibly slightly less than 10 * 1024?
> + sample++;
> + tst_res(TINFO, "MemAvailable decreased by %ld kB at iteration %d", diff, i);
> + }
> +
> + mem_avail_prev = mem_avail;
> + }
> + }
>
> - if (diff > 50 * 1024)
> - tst_res(TFAIL, "Likely kernel memory leak detected");
> + if ((sample > 5) || (diff_total > 100 * 1024))
Maybe this can rather be if ((sample > 5) && (diff_total > 100 * 1024))
That means that the available memory has been eaten by something and
that it happened more or less in a linear fashion when the program was
running.
> + tst_res(TFAIL, "Likely kernel memory leak detected, total decrease: %ld kB", diff_total);
> else
> tst_res(TPASS, "No memory leak found");
> }
> --
> 2.45.2
>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-07-17 8:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-05 3:15 [LTP] [PATCH] perf_event_open: improve the memory leak detection Li Wang
2024-07-05 3:30 ` Li Wang
2024-07-17 6:50 ` Li Wang
2024-07-17 8:31 ` Cyril Hrubis [this message]
2024-07-18 15:17 ` Martin Doucha
2024-07-18 15:20 ` Cyril Hrubis
2024-07-18 15:25 ` Martin Doucha
2024-07-19 2:02 ` Li Wang
2024-07-18 15:07 ` Martin Doucha
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=ZpeBVwXDVbJwLFu7@rei \
--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