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

Petr Vorel pvorel@suse.cz
Mon Feb 10 10:16:17 CET 2025


> Hi!
> > > +#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, ...).

> Logically save_restore is not a good candidate since we are checking a
> directory existence here. So maybe we need to add .needs_paths array of
> strings into tst_test later on...

Yeah. .needs_paths sounds reasonable + use flags we already have (TST_SR_TCONF,
TST_SR_TBROK, TST_SR_SKIP).

Kind regards,
Petr


More information about the ltp mailing list