[LTP] [PATCH v1] lib: add .min_swap_avail in tst_test struct
Li Wang
liwang@redhat.com
Tue Sep 5 05:09:49 CEST 2023
Hi Andrea,
On Mon, Sep 4, 2023 at 3:45 PM Andrea Cervesato <andrea.cervesato@suse.de>
wrote:
> From: Andrea Cervesato <andrea.cervesato@suse.com>
>
> This new field is mainly to set the minimum size of SwapFree for
> LTP testcase. If system available free swap memory is less than
> .min_swap_avail, test will be exit with TCONF.
>
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
> include/tst_memutils.h | 5 +++++
> include/tst_test.h | 3 +++
> lib/tst_memutils.c | 9 +++++++++
> lib/tst_test.c | 3 +++
> 4 files changed, 20 insertions(+)
>
> diff --git a/include/tst_memutils.h b/include/tst_memutils.h
> index 45dec55bc..19b593430 100644
> --- a/include/tst_memutils.h
> +++ b/include/tst_memutils.h
> @@ -25,6 +25,11 @@ void tst_pollute_memory(size_t maxsize, int fillchar);
> */
> long long tst_available_mem(void);
>
> +/*
> + * Read the value of SwapFree from /proc/meminfo.
> + */
> +long long tst_available_swap(void);
> +
> /*
> * Enable OOM protection to prevent process($PID) being killed by OOM
> Killer.
> * echo -1000 >/proc/$PID/oom_score_adj
> diff --git a/include/tst_test.h b/include/tst_test.h
> index 0ac492a80..75c2109b9 100644
> --- a/include/tst_test.h
> +++ b/include/tst_test.h
> @@ -210,6 +210,9 @@ struct tst_test {
> /* Minimum size(MB) of MemAvailable required by the test */
> unsigned long min_mem_avail;
>
> + /* Minimum size(MB) of SwapFree required by the test */
> + unsigned long min_swap_avail;
>
It would be great to have a brief introduction in the document,
like what we did for min_mem_avail.
Anyway, we can add it in a separate patch. Thanks!
--
Regards,
Li Wang
More information about the ltp
mailing list