[LTP] [RFC][PATCH 1/2] libs: Add safe_get_nodemap()

Petr Vorel pvorel@suse.cz
Mon Mar 31 19:55:51 CEST 2025


Hi Cyril,

> > +struct tst_nodemap *safe_get_nodemap(int type, size_t min_mem_kb, size_t required)
> > +{
> > +	struct tst_nodemap *nodes;
> > +
> > +	nodes = tst_get_nodemap(type, min_mem_kb);
> > +
> > +	if (nodes->cnt < required) {
> > +		tst_brk(TCONF, "Test requires at least %zi NUMA%s node%s",
> > +				required, tst_numa_type_name(type), required > 1 ? "s" : "");
>                                                                      ^
> 				     It does not make any sense to
> 				     request a NUMA with at least 1
> 				     node. Every computer has at least 1
> 				     node.

Thanks!

> It may make sense to TBROK if the minimal number of nodes <= 1

+1.

I guess we will find use for this even in the case of more complicated version
with struct tst_numa (it'd be used in tst_lib.c and in tests which specify nodes
via the command line parameter.

Thanks for your review!
Petr


More information about the ltp mailing list