[LTP] [PATCH 06/13] testcases/kernel/mem: Move check_hugepage() + PATH_THP

Petr Vorel pvorel@suse.cz
Fri Dec 27 11:48:05 CET 2024


Hi Cyril,

> +#define PATH_THP "/sys/kernel/mm/transparent_hugepage/"
> +
> +static inline void check_hugepage(void)
> +{
> +        if (access(PATH_HUGEPAGES, F_OK))
> +                tst_brk(TCONF, "Huge page is not supported.");
> +}

I guess we don't want to move this into static inline function (used only in 2
tests.

	if (access(PATH_THP, F_OK) == -1)
		tst_brk(TCONF, "THP not enabled in kernel?");

I also wonder if we should add to the library struct tst_test test something
like .requires_proc_sys which would check for files in /sys or /proc. There
could be an optional parameter for TCONF message. Advantage would be to have
this in docparse docs (or isn't it useful to see this)?

We have .save_restore, but that's only for files and it reads the value.
But it could share the flags (TST_SR_TCONF, TST_SR_TBROK, TST_SR_SKIP, ...).

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr


More information about the ltp mailing list