All of lore.kernel.org
 help / color / mirror / Atom feed
From: "xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com>
To: Li Wang <liwang@redhat.com>
Cc: "ltp@lists.linux.it" <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH 1/2] lib: add .min_mem_avail in tst_test struct
Date: Wed, 9 Feb 2022 09:50:20 +0000	[thread overview]
Message-ID: <62038E83.3070804@fujitsu.com> (raw)
In-Reply-To: <20220209085700.2882422-1-liwang@redhat.com>

Hi Li

This patch series looks simple and obviously ok.
So Reviewed-by: Yang Xu <xuyang2018.jy@fujitsu.com>

Best Regards
Yang Xu
> As the name implies, this new field is mainly to set the minimum size
> of MemAvailable for LTP testcase. If system available memory are less
> than .min_mem_avail, test will be exit with TCONF.
>
> And, it also helps to reduce OOM occurring in test parallel run. Due
> to running more than one process that consumes a significant amount
> of memory at the same time.
>
> Signed-off-by: Li Wang<liwang@redhat.com>
> ---
>   doc/c-test-api.txt | 6 ++++++
>   include/tst_test.h | 3 +++
>   lib/tst_test.c     | 3 +++
>   3 files changed, 12 insertions(+)
>
> diff --git a/doc/c-test-api.txt b/doc/c-test-api.txt
> index 51dac58ae..dfbb453e1 100644
> --- a/doc/c-test-api.txt
> +++ b/doc/c-test-api.txt
> @@ -2321,6 +2321,12 @@ static struct tst_test test = {
>   };
>   -------------------------------------------------------------------------------
>
> +1.40 Require minimum size of MemAvailable for a testcase
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +Some tests require more than specific size(MB) of MemAvailable. It can be defined
> +with `.min_mem_avail = N`.
> +
>   2. Common problems
>   ------------------
>
> diff --git a/include/tst_test.h b/include/tst_test.h
> index a7aaedcff..bac5e52ba 100644
> --- a/include/tst_test.h
> +++ b/include/tst_test.h
> @@ -185,6 +185,9 @@ struct tst_test {
>   	/* Minimum number of online CPU required by the test */
>   	unsigned long min_cpus;
>
> +	/* Minimum size(MB) of MemAvailable required by the test */
> +	unsigned long min_mem_avail;
> +
>   	/*
>   	 * If set non-zero number of request_hugepages, test will try to reserve the
>   	 * expected number of hugepage for testing in setup phase. If system does not
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 1fd238cf5..191a9deab 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -1090,6 +1090,9 @@ static void do_setup(int argc, char *argv[])
>   	if (tst_test->min_cpus>  (unsigned long)tst_ncpus())
>   		tst_brk(TCONF, "Test needs at least %lu CPUs online", tst_test->min_cpus);
>
> +	if (tst_test->min_mem_avail>  (unsigned long)(tst_available_mem() / 1024))
> +		tst_brk(TCONF, "Test needs at least %luMB MemAvailable", tst_test->min_mem_avail);
> +
>   	if (tst_test->request_hugepages)
>   		tst_request_hugepages(tst_test->request_hugepages);
>

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

  parent reply	other threads:[~2022-02-09  9:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09  8:56 [LTP] [PATCH 1/2] lib: add .min_mem_avail in tst_test struct Li Wang
2022-02-09  8:57 ` [LTP] [PATCH 2/2] kernel: make use of .min_mem_avail Li Wang
2022-02-09  9:50 ` xuyang2018.jy [this message]
2022-02-09 10:53 ` [LTP] [PATCH 1/2] lib: add .min_mem_avail in tst_test struct Jan Stancek
2022-02-10  9:28   ` Li Wang

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=62038E83.3070804@fujitsu.com \
    --to=xuyang2018.jy@fujitsu.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.