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

chrubis
2013-03-14T16:51:05Z

Hi!
> testcases/kernel/mem/include/mem.h | 2 ++
> testcases/kernel/mem/lib/mem.c | 2 ++
> testcases/kernel/mem/oom/oom03.c | 24 +++++++++++++++
> testcases/kernel/mem/oom/oom04.c | 63 ++++++++++++++++----------------------
> 4 files changed, 54 insertions(+), 37 deletions(-)
>
> diff --git a/testcases/kernel/mem/include/mem.h b/testcases/kernel/mem/include/mem.h
> index 1233493..de51838 100644
> --- a/testcases/kernel/mem/include/mem.h
> +++ b/testcases/kernel/mem/include/mem.h
> @@ -24,6 +24,8 @@
> #define MLOCK 3
> #define KSM 4
>
> +extern int ISNUMA;
> +
> long overcommit;
> void oom(int testcase, int mempolicy, int lite);
> void testoom(int mempolicy, int lite, int numa);
> diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
> index a71bc90..e99dae7 100644
> --- a/testcases/kernel/mem/lib/mem.c
> +++ b/testcases/kernel/mem/lib/mem.c
> @@ -24,6 +24,8 @@
> #include "mem.h"
> #include "numa_helper.h"
>
> +int ISNUMA = 0; /* mark a NUMA system */

So you have added variable to the library that is initialized in the
test setup? That is just too messy :(.

> + /* rough estimate a NUMA system through max_node */
> + if (numa_max_node() > 0) {
> + ISNUMA = 1;
> + /* For NUMA system, using the first node for cpuset.mems */
> + write_cpusets(get_a_numa_node(cleanup));
> + } else {
> + /* For nonNUMA system, using node0 for cpuset.mems */
> + write_cpusets(0);
> + }

Why couldn't we have a function is_numa() in the library that would do
something like this snippet of code, i.e. return numa_max_node() > 0
(assuming that the code is needed in other test than this one.

--
Cyril Hrubis
chrubis@suse.cz