From: David Hildenbrand <david@redhat.com>
To: "Ryan Roberts" <ryan.roberts@arm.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Shuah Khan" <shuah@kernel.org>,
"Jérôme Glisse" <jglisse@redhat.com>,
"Mark Brown" <broonie@kernel.org>,
"John Hubbard" <jhubbard@nvidia.com>,
"Florent Revest" <revest@chromium.org>,
"Peter Xu" <peterx@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v2 7/8] selftests/mm: Optionally pass duration to transhuge-stress
Date: Mon, 17 Jul 2023 19:24:35 +0200 [thread overview]
Message-ID: <64f546e6-9c65-78ca-0157-f823450d151f@redhat.com> (raw)
In-Reply-To: <20230717103152.202078-8-ryan.roberts@arm.com>
On 17.07.23 12:31, Ryan Roberts wrote:
> Until now, transhuge-stress runs until its explicitly killed, so when
> invoked by run_kselftest.sh, it would run until the test timeout, then
> it would be killed and the test would be marked as failed.
>
> Add a new, optional command line parameter that allows the user to
> specify the duration in seconds that the program should run. The program
> exits after this duration with a success (0) exit code. If the argument
> is omitted the old behacvior remains.
>
> On it's own, this doesn't quite solve our problem because
> run_kselftest.sh does not allow passing parameters to the program under
> test. But we will shortly move this to run_vmtests.sh, which does allow
> parameter passing.
>
> Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
> ---
> tools/testing/selftests/mm/transhuge-stress.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/transhuge-stress.c b/tools/testing/selftests/mm/transhuge-stress.c
> index ba9d37ad3a89..c61fb9350b8c 100644
> --- a/tools/testing/selftests/mm/transhuge-stress.c
> +++ b/tools/testing/selftests/mm/transhuge-stress.c
> @@ -25,13 +25,14 @@ int main(int argc, char **argv)
> {
> size_t ram, len;
> void *ptr, *p;
> - struct timespec a, b;
> + struct timespec start, a, b;
> int i = 0;
> char *name = NULL;
> double s;
> uint8_t *map;
> size_t map_len;
> int pagemap_fd;
> + int duration = 0;
>
> ram = sysconf(_SC_PHYS_PAGES);
> if (ram > SIZE_MAX / psize() / 4)
> @@ -42,9 +43,11 @@ int main(int argc, char **argv)
>
> while (++i < argc) {
> if (!strcmp(argv[i], "-h"))
> - errx(1, "usage: %s [size in MiB]", argv[0]);
> + errx(1, "usage: %s [-f <filename>] [-d <duration>] [size in MiB]", argv[0]);
> else if (!strcmp(argv[i], "-f"))
> name = argv[++i];
> + else if (!strcmp(argv[i], "-d"))
> + duration = atoi(argv[++i]);
> else
> len = atoll(argv[i]) << 20;
> }
> @@ -78,6 +81,8 @@ int main(int argc, char **argv)
> if (!map)
> errx(2, "map malloc");
>
> + clock_gettime(CLOCK_MONOTONIC, &start);
> +
> while (1) {
> int nr_succeed = 0, nr_failed = 0, nr_pages = 0;
>
> @@ -118,5 +123,8 @@ int main(int argc, char **argv)
> "%4d succeed, %4d failed, %4d different pages",
> s, s * 1000 / (len >> HPAGE_SHIFT), len / s / (1 << 20),
> nr_succeed, nr_failed, nr_pages);
> +
> + if (duration > 0 && b.tv_sec - start.tv_sec >= duration)
> + return 0;
> }
> }
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2023-07-17 17:24 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 10:31 [PATCH v2 0/8] selftests/mm fixes for arm64 Ryan Roberts
2023-07-17 10:31 ` [PATCH v2 1/8] selftests: Line buffer test program's stdout Ryan Roberts
2023-07-17 17:22 ` Mark Brown
2023-07-17 10:31 ` [PATCH v2 2/8] selftests/mm: Skip soft-dirty tests on arm64 Ryan Roberts
2023-07-17 17:20 ` David Hildenbrand
2023-07-17 10:31 ` [PATCH v2 3/8] selftests/mm: Enable mrelease_test for arm64 Ryan Roberts
2023-07-17 10:31 ` [PATCH v2 4/8] selftests/mm: Fix thuge-gen test bugs Ryan Roberts
2023-07-17 17:22 ` David Hildenbrand
2023-07-17 10:31 ` [PATCH v2 5/8] selftests/mm: va_high_addr_switch should skip unsupported arm64 configs Ryan Roberts
2023-07-17 10:31 ` [PATCH v2 6/8] selftests/mm: Make migration test robust to failure Ryan Roberts
2023-07-17 17:40 ` David Hildenbrand
2023-07-18 10:49 ` Ryan Roberts
2023-07-18 11:23 ` David Hildenbrand
2023-07-18 11:24 ` David Hildenbrand
2023-07-18 12:42 ` Ryan Roberts
2023-07-18 15:24 ` David Hildenbrand
2023-07-17 10:31 ` [PATCH v2 7/8] selftests/mm: Optionally pass duration to transhuge-stress Ryan Roberts
2023-07-17 17:24 ` David Hildenbrand [this message]
2023-07-17 10:31 ` [PATCH v2 8/8] selftests/mm: Run all tests from run_vmtests.sh Ryan Roberts
2023-07-17 17:27 ` David Hildenbrand
2023-07-19 20:45 ` Peter Xu
2023-07-20 8:14 ` Ryan Roberts
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=64f546e6-9c65-78ca-0157-f823450d151f@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=broonie@kernel.org \
--cc=jglisse@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.com \
--cc=revest@chromium.org \
--cc=ryan.roberts@arm.com \
--cc=shuah@kernel.org \
/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