Hi Jan, On 03/15/2013 01:26 AM, Jan Stancek wrote: > > ----- Original Message ----- >> From: [email protected] >> To: "Zhouping Liu" <[email protected]> >> Cc: "LTP List" <[email protected]> >> Sent: Thursday, 14 March, 2013 5:51:43 PM >> Subject: Re: [LTP] [PATCH 3/5] mm/oom0[3|4]: added 'OOM for CPUSET' and >> updated 'OOM with MEMCG & numa' >> >> 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. > 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.
yes, what you care about is right, but now we only need a function, which can tell us the system have more than one node, we don't care about the nodes have CPUs or memory. so I will created is_numa() in numa_helper to implement it. Thanks Zhouping ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
