From: Jan Stancek <jstancek@redhat.com>
To: Zhouping Liu <zliu@redhat.com>
Cc: LTP List <ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [PATCH v2 3/7] numa_helper: added a new function is_numa()
Date: Fri, 15 Mar 2013 12:09:57 -0400 (EDT) [thread overview]
Message-ID: <1555759857.19404682.1363363797191.JavaMail.root@redhat.com> (raw)
In-Reply-To: <5de33faa5b15f22e96d68d1b543eb4bcfc64cfb7.1363358877.git.zliu@redhat.com>
----- Original Message -----
> From: "Zhouping Liu" <zliu@redhat.com>
> To: "LTP List" <ltp-list@lists.sourceforge.net>
> Sent: Friday, 15 March, 2013 4:03:08 PM
> Subject: [LTP] [PATCH v2 3/7] numa_helper: added a new function is_numa()
>
> Added a new function is_numa(), which is desinged to judge
> whether a system contains more than 1 available numa nodes
> or not, and lots of cases need it.
>
> Signed-off-by: Zhouping Liu <zliu@redhat.com>
> ---
> testcases/kernel/include/numa_helper.h | 1 +
> testcases/kernel/lib/numa_helper.c | 25
> +++++++++++++++++++++++++
> 2 files changed, 26 insertions(+)
>
> diff --git a/testcases/kernel/include/numa_helper.h
> b/testcases/kernel/include/numa_helper.h
> index 8e82d7b..251fd54 100644
> --- a/testcases/kernel/include/numa_helper.h
> +++ b/testcases/kernel/include/numa_helper.h
> @@ -34,5 +34,6 @@ unsigned long get_max_node(void);
> int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes);
> int get_allowed_nodes(int flag, int count, ...);
> void nh_dump_nodes();
> +int is_numa(void (*cleanup_fn)(void));
>
> #endif
> diff --git a/testcases/kernel/lib/numa_helper.c
> b/testcases/kernel/lib/numa_helper.c
> index 4ab8e3c..f9a4c3a 100644
> --- a/testcases/kernel/lib/numa_helper.c
> +++ b/testcases/kernel/lib/numa_helper.c
> @@ -265,3 +265,28 @@ void nh_dump_nodes()
> print_node_info(NH_CPUS);
> print_node_info(NH_MEMS | NH_CPUS);
> }
> +
> +/*
> + * is_numa - judge a system is NUMA system or not
> + * NOTE: the function is designed to try to find more than
> + * 1 available node, at least each node contains memory.
> + * WARN: Don't use this func in child, as it calls tst_brkm()
> + * RETURNS:
> + * 0 - it's not a NUMA system
> + * 1 - it's a NUMA system
> + */
> +int is_numa(void (*cleanup_fn)(void))
> +{
> + int ret;
> + int numa_nodes = 0;
> + int *nodes = NULL;
> +
> + ret = get_allowed_nodes_arr(NH_MEMS, &numa_nodes, &nodes);
If you don't need node ids, you can pass NULL:
ret = get_allowed_nodes_arr(NH_MEMS, &numa_nodes, NULL);
Otherwise you should free 'nodes' variable.
> + if (ret < 0)
> + tst_brkm(TBROK | TERRNO, cleanup_fn, "get_allowed_nodes_arr");
> +
> + if (numa_nodes > 1)
> + return 1;
> + else
> + return 0;
> +}
> --
> 1.7.11.7
>
>
> ------------------------------------------------------------------------------
> 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
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2013-03-15 16:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-15 15:03 [LTP] [PATCH v2 0/7] mm/oom: extend the coverage of OOM Zhouping Liu
2013-03-15 15:03 ` [LTP] [PATCH v2 1/7] lib/mem: modified _gather_cpus() as _gather_node_cpus() Zhouping Liu
2013-03-15 15:03 ` [LTP] [PATCH v2 2/7] mm/oom02: modified 'OOM for NUMA' as 'OOM for mempolicy' Zhouping Liu
2013-03-15 15:03 ` [LTP] [PATCH v2 3/7] numa_helper: added a new function is_numa() Zhouping Liu
2013-03-15 16:09 ` Jan Stancek [this message]
2013-03-18 2:33 ` Zhouping Liu
2013-03-15 15:03 ` [LTP] [PATCH v2 4/7] mm/oom0[3|4]: added 'OOM for CPUSET' and moved 'OOM with MEMCG & numa' to oom03 Zhouping Liu
2013-03-15 15:03 ` [LTP] [PATCH v2 5/7] lib/mem: updated testoom() and oom() funcs Zhouping Liu
2013-03-15 15:03 ` [LTP] [PATCH v2 6/7] mm/oom05: new testcase Zhouping Liu
2013-03-15 15:03 ` [LTP] [PATCH v2 7/7] lib/mem: removed the prefix underscore '_' of the internal function name Zhouping Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1555759857.19404682.1363363797191.JavaMail.root@redhat.com \
--to=jstancek@redhat.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=zliu@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox