Re: [LTP] [PATCH 3/5] mm/oom0[3|4]: added 'OOM for CPUSET' and updated 'OOM with MEMCG & numa'

chrubis
2013-03-14T18:31:56Z

Hi!
> We added numa_helper library to be able to get number of nodes, as well
> as list of nodes (with memory, cpu or both). numa_max_node() > 0 doesn't
> tell you how many nodes you have.
>
> Here's sample use to get just node count:
> ----------------------------------------------------------------
> #include <stdio.h>
> #include "numa_helper.h"
>
> const char *TCID="test";
> int main()
> {
> int num_nodes;
> int ret = get_allowed_nodes_arr(NH_MEMS | NH_CPUS, &num_nodes, NULL);
> printf("ret: %d, nodes:%d\n", ret, num_nodes);
> return 0;
> }
> ----------------------------------------------------------------
>
> We could add a simple function to numa_helper, but I'm not sure what
> it would return as default, some tests care about nodes with memory.

Maybe we misunderstand about what I see as a problem here. This patch
adds integer variable to the lib/mem.c library and that variable is then
only used within the tests. That just looks like wrong desing to me.

The code snippet "numa_max_node() > 0" was take from one of the tests
that initializes the variable in question (the pattern seems to repeat
in them). So I wasn't proposing any functional changes in the code just
requesting cleaner desing.

--
Cyril Hrubis
chrubis@suse.cz