[LTP] [RFC][PATCH 0/2] Add safe_get_nodemap()
Cyril Hrubis
chrubis@suse.cz
Wed Apr 2 12:14:28 CEST 2025
Hi!
> +1, thanks for suggesting a proper struct :).
>
> BTW why we can use enum tst_numa_types in struct and not as function parameter?
Lazines I suppose.
> -struct tst_nodemap *tst_get_nodemap(int type, size_t min_mem_kb);
> +struct tst_nodemap *tst_get_nodemap(enum tst_numa_types type, size_t min_mem_kb);
>
> Old toolchains? Maybe not needed nowadays? I guess with using enum we could get
> rid of the check for enum validity:
> if (type & ~(TST_NUMA_MEM))
> tst_brk(TBROK, "Invalid type %i\n", type);
No we couldn't because you can stil pass whatever you want even when the
type is enum.
> > And then use that in tst_test structure. That would certainly make
> > sense, but I guess that we would have to move the numa library to the
> > lib/ as well. I'm not sure that we can have a function call from
> > tst_test.c library to something that is not compiled in by default.
>
> Correct, file is in libs/numa/tst_numa.c. But how about use predecessor check?
>
> if (tst_test->numa) {
> #ifdef HAVE_NUMA_V2
> ...
> #else
> tst_brk(TCONF, NUMA_ERROR_MSG);
> #endif
> }
>
> With help we would even get rid of else part of the compile check in the
> tests:
>
> #else
> TST_TEST_TCONF(NUMA_ERROR_MSG);
>
> But we would have modify lib/Makefile to conditionally add "-lnuma -lltpnuma".
> "-lnuma" would be based on NUMA_LIBS (stored in include/mk/config.mk, detected
> in m4/ltp-numa.m4), e.g. something like this could work:
>
> ifneq ($(NUMA_LIBS),)
> LDLIBS += $(NUMA_LIBS) -lltpnuma
> endif
I do no think that this would be enough, because all tests are linking
againts -lltp and if -lltp potentionally calls into the libnuma suddenly
all tests has to be linked againts libnuma. Or libnuma must be moved
into the ltp library.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list