* [LTP] [PATCH] mm/oom05: new testcase @ 2012-06-26 15:57 Zhouping Liu 2012-06-29 2:23 ` Zhouping Liu 0 siblings, 1 reply; 13+ messages in thread From: Zhouping Liu @ 2012-06-26 15:57 UTC (permalink / raw) To: LTP List add a new testcase to test OOM on each NUMA node Signed-off-by: Zhouping Liu <zliu@redhat.com> --- runtest/mm | 1 + testcases/kernel/mem/oom/oom05.c | 131 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 testcases/kernel/mem/oom/oom05.c diff --git a/runtest/mm b/runtest/mm index 2dd66f0..a60c04b 100644 --- a/runtest/mm +++ b/runtest/mm @@ -77,6 +77,7 @@ oom01 oom01 oom02 oom02 oom03 oom03 oom04 oom04 +oom05 oom05 swapping01 swapping01 -i 5 diff --git a/testcases/kernel/mem/oom/oom05.c b/testcases/kernel/mem/oom/oom05.c new file mode 100644 index 0000000..046ddbb --- /dev/null +++ b/testcases/kernel/mem/oom/oom05.c @@ -0,0 +1,131 @@ +/* + * Out Of Memory (OOM) on Each NUMA nodes + * + * The program is designed to cope with unpredictable like amount and + * system physical memory, swap size and other VMM technology like KSM, + * memcg, memory hotplug and so on which may affect the OOM + * behaviours. It simply increase the memory consumption 3G each time + * until all the available memory is consumed and OOM is triggered. + * + * Copyright (C) 2012 Red Hat, Inc. + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it + * is free of the rightful claim of any third person regarding + * infringement or the like. Any license provided herein, whether + * implied or otherwise, applies only to this software file. Patent + * licenses, if any, provided herein do not apply to combinations of + * this program with other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include "test.h" +#include "safe_macros.h" +#include "usctest.h" +#include "mem.h" + +char *TCID = "oom05"; +int TST_TOTAL = 1; + +#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \ + && HAVE_MPOL_CONSTANTS +#include <numa.h> +#include <numaif.h> + +int main(int argc, char *argv[]) +{ + char *msg; + int lc; + long nodes[MAXNODES]; + int nnodes, i; + pid_t pids[MAXNODES]; + int status; + unsigned long nmasks[MAXNODES]; + + msg = parse_opts(argc, argv, NULL, NULL); + if (msg != NULL) + tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); + +#if __WORDSIZE == 32 + tst_brkm(TCONF, NULL, "test is not designed for 32-bit system."); +#endif + nnodes = count_numa(nodes); + if (nnodes <= 1) + tst_brkm(TCONF, NULL, "required a NUMA system."); + + setup(); + + set_sys_tune("overcommit_memory", 1, 1); + + for (lc = 0; TEST_LOOPING(lc); lc++) { + Tst_count = 0; + + for (i = 0; i < nnodes; i++) { + nmasks[i] = 1 << nodes[i]; + switch (pids[i] = fork()) { + case -1: + tst_brkm(TBROK|TERRNO, cleanup, "fork"); + case 0: + if (set_mempolicy(MPOL_BIND, &nmasks[i], + MAXNODES) == -1) + tst_brkm(TBROK|TERRNO, cleanup, + "set_mempolicy"); + tst_resm(TINFO, "start oom on numa node%lu", + nodes[i]); + oom(NORMAL, 0, 0); + exit(0); + } + } + + for (i = 0; i < nnodes; i++) { + if (waitpid(pids[i], &status, WUNTRACED|WCONTINUED) == -1) + tst_brkm(TBROK|TERRNO, cleanup, "waitpid"); + + if (WIFEXITED(status) && WEXITSTATUS(status) != 0) + tst_resm(TFAIL, "child[%d] exit with " + "status: %d", pids[i], status); + } + } + cleanup(); + tst_exit(); +} + +void setup(void) +{ + tst_require_root(NULL); + tst_sig(FORK, DEF_HANDLER, cleanup); + TEST_PAUSE; + + overcommit = get_sys_tune("overcommit_memory"); +} + +void cleanup(void) +{ + set_sys_tune("overcommit_memory", overcommit, 0); + + TEST_CLEANUP; +} + +#else /* no NUMA */ +int main(void) +{ + tst_brkm(TCONF, NULL, "no NUMA development packages installed."); +} +#endif -- 1.7.10.2 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [LTP] [PATCH] mm/oom05: new testcase 2012-06-26 15:57 [LTP] [PATCH] mm/oom05: new testcase Zhouping Liu @ 2012-06-29 2:23 ` Zhouping Liu 2012-06-29 2:39 ` Wanlong Gao 0 siblings, 1 reply; 13+ messages in thread From: Zhouping Liu @ 2012-06-29 2:23 UTC (permalink / raw) To: LTP List Hi, ----- Original Message ----- > From: "Zhouping Liu" <zliu@redhat.com> > To: "LTP List" <ltp-list@lists.sourceforge.net> > Sent: Tuesday, June 26, 2012 11:57:35 PM > Subject: [LTP] [PATCH] mm/oom05: new testcase > > add a new testcase to test OOM on each NUMA node I have tested it in several systems with 2 NUMA nodes and 8 NUMA nodes, they are all good, any comment? Thanks, Zhouping > > Signed-off-by: Zhouping Liu <zliu@redhat.com> > --- > runtest/mm | 1 + > testcases/kernel/mem/oom/oom05.c | 131 > ++++++++++++++++++++++++++++++++++++++ > 2 files changed, 132 insertions(+) > create mode 100644 testcases/kernel/mem/oom/oom05.c > > diff --git a/runtest/mm b/runtest/mm > index 2dd66f0..a60c04b 100644 > --- a/runtest/mm > +++ b/runtest/mm > @@ -77,6 +77,7 @@ oom01 oom01 > oom02 oom02 > oom03 oom03 > oom04 oom04 > +oom05 oom05 > > swapping01 swapping01 -i 5 > > diff --git a/testcases/kernel/mem/oom/oom05.c > b/testcases/kernel/mem/oom/oom05.c > new file mode 100644 > index 0000000..046ddbb > --- /dev/null > +++ b/testcases/kernel/mem/oom/oom05.c > @@ -0,0 +1,131 @@ > +/* > + * Out Of Memory (OOM) on Each NUMA nodes > + * > + * The program is designed to cope with unpredictable like amount > and > + * system physical memory, swap size and other VMM technology like > KSM, > + * memcg, memory hotplug and so on which may affect the OOM > + * behaviours. It simply increase the memory consumption 3G each > time > + * until all the available memory is consumed and OOM is triggered. > + * > + * Copyright (C) 2012 Red Hat, Inc. > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of version 2 of the GNU General Public > + * License as published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it would be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > + * > + * Further, this software is distributed without any warranty that > it > + * is free of the rightful claim of any third person regarding > + * infringement or the like. Any license provided herein, whether > + * implied or otherwise, applies only to this software file. Patent > + * licenses, if any, provided herein do not apply to combinations of > + * this program with other software, or any other product > whatsoever. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > + * 02110-1301, USA. > + */ > +#include <sys/types.h> > +#include <sys/stat.h> > +#include <sys/wait.h> > +#include <errno.h> > +#include <fcntl.h> > +#include <stdio.h> > +#include <stdlib.h> > +#include <unistd.h> > +#include "test.h" > +#include "safe_macros.h" > +#include "usctest.h" > +#include "mem.h" > + > +char *TCID = "oom05"; > +int TST_TOTAL = 1; > + > +#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \ > + && HAVE_MPOL_CONSTANTS > +#include <numa.h> > +#include <numaif.h> > + > +int main(int argc, char *argv[]) > +{ > + char *msg; > + int lc; > + long nodes[MAXNODES]; > + int nnodes, i; > + pid_t pids[MAXNODES]; > + int status; > + unsigned long nmasks[MAXNODES]; > + > + msg = parse_opts(argc, argv, NULL, NULL); > + if (msg != NULL) > + tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); > + > +#if __WORDSIZE == 32 > + tst_brkm(TCONF, NULL, "test is not designed for 32-bit system."); > +#endif > + nnodes = count_numa(nodes); > + if (nnodes <= 1) > + tst_brkm(TCONF, NULL, "required a NUMA system."); > + > + setup(); > + > + set_sys_tune("overcommit_memory", 1, 1); > + > + for (lc = 0; TEST_LOOPING(lc); lc++) { > + Tst_count = 0; > + > + for (i = 0; i < nnodes; i++) { > + nmasks[i] = 1 << nodes[i]; > + switch (pids[i] = fork()) { > + case -1: > + tst_brkm(TBROK|TERRNO, cleanup, "fork"); > + case 0: > + if (set_mempolicy(MPOL_BIND, &nmasks[i], > + MAXNODES) == -1) > + tst_brkm(TBROK|TERRNO, cleanup, > + "set_mempolicy"); > + tst_resm(TINFO, "start oom on numa node%lu", > + nodes[i]); > + oom(NORMAL, 0, 0); > + exit(0); > + } > + } > + > + for (i = 0; i < nnodes; i++) { > + if (waitpid(pids[i], &status, WUNTRACED|WCONTINUED) == -1) > + tst_brkm(TBROK|TERRNO, cleanup, "waitpid"); > + > + if (WIFEXITED(status) && WEXITSTATUS(status) != 0) > + tst_resm(TFAIL, "child[%d] exit with " > + "status: %d", pids[i], status); > + } > + } > + cleanup(); > + tst_exit(); > +} > + > +void setup(void) > +{ > + tst_require_root(NULL); > + tst_sig(FORK, DEF_HANDLER, cleanup); > + TEST_PAUSE; > + > + overcommit = get_sys_tune("overcommit_memory"); > +} > + > +void cleanup(void) > +{ > + set_sys_tune("overcommit_memory", overcommit, 0); > + > + TEST_CLEANUP; > +} > + > +#else /* no NUMA */ > +int main(void) > +{ > + tst_brkm(TCONF, NULL, "no NUMA development packages installed."); > +} > +#endif > -- > 1.7.10.2 > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. > Discussions > will include endpoint security, mobile security and the latest in > malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Ltp-list mailing list > Ltp-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ltp-list > -- Thanks, Zhouping ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [LTP] [PATCH] mm/oom05: new testcase 2012-06-29 2:23 ` Zhouping Liu @ 2012-06-29 2:39 ` Wanlong Gao 2012-06-29 4:37 ` Zhouping Liu 2012-06-29 7:33 ` Jan Stancek 0 siblings, 2 replies; 13+ messages in thread From: Wanlong Gao @ 2012-06-29 2:39 UTC (permalink / raw) To: Zhouping Liu; +Cc: LTP List On 06/29/2012 10:23 AM, Zhouping Liu wrote: > Hi, > > ----- Original Message ----- >> From: "Zhouping Liu" <zliu@redhat.com> >> To: "LTP List" <ltp-list@lists.sourceforge.net> >> Sent: Tuesday, June 26, 2012 11:57:35 PM >> Subject: [LTP] [PATCH] mm/oom05: new testcase >> >> add a new testcase to test OOM on each NUMA node > > I have tested it in several systems with 2 NUMA nodes and 8 NUMA nodes, > they are all good, any comment? > > Thanks, > Zhouping > >> >> Signed-off-by: Zhouping Liu <zliu@redhat.com> >> --- >> runtest/mm | 1 + >> testcases/kernel/mem/oom/oom05.c | 131 >> ++++++++++++++++++++++++++++++++++++++ >> 2 files changed, 132 insertions(+) >> create mode 100644 testcases/kernel/mem/oom/oom05.c >> >> diff --git a/runtest/mm b/runtest/mm >> index 2dd66f0..a60c04b 100644 >> --- a/runtest/mm >> +++ b/runtest/mm >> @@ -77,6 +77,7 @@ oom01 oom01 >> oom02 oom02 >> oom03 oom03 >> oom04 oom04 >> +oom05 oom05 >> >> swapping01 swapping01 -i 5 >> >> diff --git a/testcases/kernel/mem/oom/oom05.c >> b/testcases/kernel/mem/oom/oom05.c >> new file mode 100644 >> index 0000000..046ddbb >> --- /dev/null >> +++ b/testcases/kernel/mem/oom/oom05.c >> @@ -0,0 +1,131 @@ >> +/* >> + * Out Of Memory (OOM) on Each NUMA nodes >> + * >> + * The program is designed to cope with unpredictable like amount >> and >> + * system physical memory, swap size and other VMM technology like >> KSM, >> + * memcg, memory hotplug and so on which may affect the OOM >> + * behaviours. It simply increase the memory consumption 3G each >> time >> + * until all the available memory is consumed and OOM is triggered. >> + * >> + * Copyright (C) 2012 Red Hat, Inc. >> + * This program is free software; you can redistribute it and/or >> + * modify it under the terms of version 2 of the GNU General Public >> + * License as published by the Free Software Foundation. >> + * >> + * This program is distributed in the hope that it would be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. >> + * >> + * Further, this software is distributed without any warranty that >> it >> + * is free of the rightful claim of any third person regarding >> + * infringement or the like. Any license provided herein, whether >> + * implied or otherwise, applies only to this software file. Patent >> + * licenses, if any, provided herein do not apply to combinations of >> + * this program with other software, or any other product >> whatsoever. >> + * >> + * You should have received a copy of the GNU General Public License >> + * along with this program; if not, write the Free Software >> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA >> + * 02110-1301, USA. >> + */ >> +#include <sys/types.h> >> +#include <sys/stat.h> >> +#include <sys/wait.h> >> +#include <errno.h> >> +#include <fcntl.h> >> +#include <stdio.h> >> +#include <stdlib.h> >> +#include <unistd.h> >> +#include "test.h" >> +#include "safe_macros.h" >> +#include "usctest.h" >> +#include "mem.h" >> + >> +char *TCID = "oom05"; >> +int TST_TOTAL = 1; >> + >> +#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \ >> + && HAVE_MPOL_CONSTANTS >> +#include <numa.h> >> +#include <numaif.h> >> + >> +int main(int argc, char *argv[]) >> +{ >> + char *msg; >> + int lc; >> + long nodes[MAXNODES]; >> + int nnodes, i; >> + pid_t pids[MAXNODES]; >> + int status; >> + unsigned long nmasks[MAXNODES]; >> + >> + msg = parse_opts(argc, argv, NULL, NULL); >> + if (msg != NULL) >> + tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); >> + >> +#if __WORDSIZE == 32 >> + tst_brkm(TCONF, NULL, "test is not designed for 32-bit system."); >> +#endif >> + nnodes = count_numa(nodes); >> + if (nnodes <= 1) >> + tst_brkm(TCONF, NULL, "required a NUMA system."); >> + >> + setup(); >> + >> + set_sys_tune("overcommit_memory", 1, 1); >> + >> + for (lc = 0; TEST_LOOPING(lc); lc++) { >> + Tst_count = 0; >> + >> + for (i = 0; i < nnodes; i++) { >> + nmasks[i] = 1 << nodes[i]; >> + switch (pids[i] = fork()) { >> + case -1: >> + tst_brkm(TBROK|TERRNO, cleanup, "fork"); >> + case 0: >> + if (set_mempolicy(MPOL_BIND, &nmasks[i], >> + MAXNODES) == -1) >> + tst_brkm(TBROK|TERRNO, cleanup, >> + "set_mempolicy"); >> + tst_resm(TINFO, "start oom on numa node%lu", >> + nodes[i]); >> + oom(NORMAL, 0, 0); >> + exit(0); >> + } >> + } Hi Zhouping, Does it need get_allowed_nodes() that Jan added? Thanks, Wanlong Gao >> + >> + for (i = 0; i < nnodes; i++) { >> + if (waitpid(pids[i], &status, WUNTRACED|WCONTINUED) == -1) >> + tst_brkm(TBROK|TERRNO, cleanup, "waitpid"); >> + >> + if (WIFEXITED(status) && WEXITSTATUS(status) != 0) >> + tst_resm(TFAIL, "child[%d] exit with " >> + "status: %d", pids[i], status); >> + } >> + } >> + cleanup(); >> + tst_exit(); >> +} >> + >> +void setup(void) >> +{ >> + tst_require_root(NULL); >> + tst_sig(FORK, DEF_HANDLER, cleanup); >> + TEST_PAUSE; >> + >> + overcommit = get_sys_tune("overcommit_memory"); >> +} >> + >> +void cleanup(void) >> +{ >> + set_sys_tune("overcommit_memory", overcommit, 0); >> + >> + TEST_CLEANUP; >> +} >> + >> +#else /* no NUMA */ >> +int main(void) >> +{ >> + tst_brkm(TCONF, NULL, "no NUMA development packages installed."); >> +} >> +#endif >> -- >> 1.7.10.2 >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. >> Discussions >> will include endpoint security, mobile security and the latest in >> malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Ltp-list mailing list >> Ltp-list@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/ltp-list >> > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [LTP] [PATCH] mm/oom05: new testcase 2012-06-29 2:39 ` Wanlong Gao @ 2012-06-29 4:37 ` Zhouping Liu 2012-07-03 7:41 ` Caspar Zhang ` (2 more replies) 2012-06-29 7:33 ` Jan Stancek 1 sibling, 3 replies; 13+ messages in thread From: Zhouping Liu @ 2012-06-29 4:37 UTC (permalink / raw) To: gaowanlong; +Cc: LTP List, CAI Qian Hi, ----- Original Message ----- > From: "Wanlong Gao" <gaowanlong@cn.fujitsu.com> > To: "Zhouping Liu" <zliu@redhat.com> > Cc: "LTP List" <ltp-list@lists.sourceforge.net>, "Jan Stancek" <jstancek@redhat.com> > Sent: Friday, June 29, 2012 10:39:57 AM > Subject: Re: [LTP] [PATCH] mm/oom05: new testcase > > On 06/29/2012 10:23 AM, Zhouping Liu wrote: > > Hi, > > > > ----- Original Message ----- > >> From: "Zhouping Liu" <zliu@redhat.com> > >> To: "LTP List" <ltp-list@lists.sourceforge.net> > >> Sent: Tuesday, June 26, 2012 11:57:35 PM > >> Subject: [LTP] [PATCH] mm/oom05: new testcase > >> > >> add a new testcase to test OOM on each NUMA node > > > > I have tested it in several systems with 2 NUMA nodes and 8 NUMA > > nodes, > > they are all good, any comment? > > > > Thanks, > > Zhouping > > > >> > >> Signed-off-by: Zhouping Liu <zliu@redhat.com> > >> --- > >> runtest/mm | 1 + > >> testcases/kernel/mem/oom/oom05.c | 131 > >> ++++++++++++++++++++++++++++++++++++++ > >> 2 files changed, 132 insertions(+) > >> create mode 100644 testcases/kernel/mem/oom/oom05.c > >> > >> diff --git a/runtest/mm b/runtest/mm > >> index 2dd66f0..a60c04b 100644 > >> --- a/runtest/mm > >> +++ b/runtest/mm > >> @@ -77,6 +77,7 @@ oom01 oom01 > >> oom02 oom02 > >> oom03 oom03 > >> oom04 oom04 > >> +oom05 oom05 > >> > >> swapping01 swapping01 -i 5 > >> > >> diff --git a/testcases/kernel/mem/oom/oom05.c > >> b/testcases/kernel/mem/oom/oom05.c > >> new file mode 100644 > >> index 0000000..046ddbb > >> --- /dev/null > >> +++ b/testcases/kernel/mem/oom/oom05.c > >> @@ -0,0 +1,131 @@ > >> +/* > >> + * Out Of Memory (OOM) on Each NUMA nodes > >> + * > >> + * The program is designed to cope with unpredictable like amount > >> and > >> + * system physical memory, swap size and other VMM technology > >> like > >> KSM, > >> + * memcg, memory hotplug and so on which may affect the OOM > >> + * behaviours. It simply increase the memory consumption 3G each > >> time > >> + * until all the available memory is consumed and OOM is > >> triggered. > >> + * > >> + * Copyright (C) 2012 Red Hat, Inc. > >> + * This program is free software; you can redistribute it and/or > >> + * modify it under the terms of version 2 of the GNU General > >> Public > >> + * License as published by the Free Software Foundation. > >> + * > >> + * This program is distributed in the hope that it would be > >> useful, > >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of > >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > >> + * > >> + * Further, this software is distributed without any warranty > >> that > >> it > >> + * is free of the rightful claim of any third person regarding > >> + * infringement or the like. Any license provided herein, > >> whether > >> + * implied or otherwise, applies only to this software file. > >> Patent > >> + * licenses, if any, provided herein do not apply to combinations > >> of > >> + * this program with other software, or any other product > >> whatsoever. > >> + * > >> + * You should have received a copy of the GNU General Public > >> License > >> + * along with this program; if not, write the Free Software > >> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > >> + * 02110-1301, USA. > >> + */ > >> +#include <sys/types.h> > >> +#include <sys/stat.h> > >> +#include <sys/wait.h> > >> +#include <errno.h> > >> +#include <fcntl.h> > >> +#include <stdio.h> > >> +#include <stdlib.h> > >> +#include <unistd.h> > >> +#include "test.h" > >> +#include "safe_macros.h" > >> +#include "usctest.h" > >> +#include "mem.h" > >> + > >> +char *TCID = "oom05"; > >> +int TST_TOTAL = 1; > >> + > >> +#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \ > >> + && HAVE_MPOL_CONSTANTS > >> +#include <numa.h> > >> +#include <numaif.h> > >> + > >> +int main(int argc, char *argv[]) > >> +{ > >> + char *msg; > >> + int lc; > >> + long nodes[MAXNODES]; > >> + int nnodes, i; > >> + pid_t pids[MAXNODES]; > >> + int status; > >> + unsigned long nmasks[MAXNODES]; > >> + > >> + msg = parse_opts(argc, argv, NULL, NULL); > >> + if (msg != NULL) > >> + tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); > >> + > >> +#if __WORDSIZE == 32 > >> + tst_brkm(TCONF, NULL, "test is not designed for 32-bit > >> system."); > >> +#endif > >> + nnodes = count_numa(nodes); > >> + if (nnodes <= 1) > >> + tst_brkm(TCONF, NULL, "required a NUMA system."); > >> + > >> + setup(); > >> + > >> + set_sys_tune("overcommit_memory", 1, 1); > >> + > >> + for (lc = 0; TEST_LOOPING(lc); lc++) { > >> + Tst_count = 0; > >> + > >> + for (i = 0; i < nnodes; i++) { > >> + nmasks[i] = 1 << nodes[i]; > >> + switch (pids[i] = fork()) { > >> + case -1: > >> + tst_brkm(TBROK|TERRNO, cleanup, "fork"); > >> + case 0: > >> + if (set_mempolicy(MPOL_BIND, &nmasks[i], > >> + MAXNODES) == -1) > >> + tst_brkm(TBROK|TERRNO, cleanup, > >> + "set_mempolicy"); > >> + tst_resm(TINFO, "start oom on numa node%lu", > >> + nodes[i]); > >> + oom(NORMAL, 0, 0); > >> + exit(0); > >> + } > >> + } > > Hi Zhouping, > > Does it need get_allowed_nodes() that Jan added? > yes, I met some errors when the system has unbalance NUMA system: the follow test machine has 2 numa nodes 0-1, I offline all node1's cpu # echo 0 > /sys/devices/system/node1/cpu*/online then you will find node1 don't contain any available cpus: # numactl -H available: 2 nodes (0-1) node 0 cpus: 0 1 2 3 node 0 size: 4084 MB node 0 free: 2929 MB node 1 cpus: node 1 size: 4096 MB node 1 free: 3949 MB node distances: node 0 1 0: 10 21 1: 21 10 under such above setup, oom[2|4] will failed: ... oom02 0 TINFO : process cpuset. oom02 1 TBROK : write /dev/cpuset/1/cpuset.cpus: errno=EINVAL(22): Invalid argument oom02 2 TBROK : Remaining cases broken oom02 0 TINFO : set overcommit_memory to 0 oom02 0 TWARN : umount /dev/cpuset: errno=EBUSY(16): Device or resource busy oom02 0 TWARN : rmdir /dev/cpuset: errno=EBUSY(16): Device or resource busy the failure is because node1 didn't have available cpus, but it tried to write node1's cpus to /dev/cpuset/1/cpuset.cpus. and I tested get_allowed_nodes(), it didn't fix the error, with above setup, I expected get_allowed_nodes_arr() can mark node1 is a unavailable node, but in actual it didn't, and it's the similar with count_numa() inside testcase/kernel/mem/lib/mem.c. so, Jan, do you have any thoughts to avoid the issues? if get-allowed_nodes* can fix these issues, I also suggest we can define them in ltp/include/numa_helper.h or other file name, comments? Thansk, Zhuoping ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [LTP] [PATCH] mm/oom05: new testcase 2012-06-29 4:37 ` Zhouping Liu @ 2012-07-03 7:41 ` Caspar Zhang 2012-07-03 8:03 ` Jan Stancek 2012-07-10 10:37 ` Caspar Zhang 2 siblings, 0 replies; 13+ messages in thread From: Caspar Zhang @ 2012-07-03 7:41 UTC (permalink / raw) To: Zhouping Liu; +Cc: LTP List, CAI Qian On 06/29/2012 12:37 PM, Zhouping Liu wrote: > and I tested get_allowed_nodes(), it didn't fix the error, > with above setup, I expected get_allowed_nodes_arr() can mark node1 is a unavailable node, > but in actual it didn't, and it's the similar with count_numa() inside testcase/kernel/mem/lib/mem.c. > so, Jan, do you have any thoughts to avoid the issues? if get-allowed_nodes* can fix these issues, I also suggest we can > define them in ltp/include/numa_helper.h or other file name, comments? Hi Zhouping, can you propose a patch for this? Thanks, Caspar ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [LTP] [PATCH] mm/oom05: new testcase 2012-06-29 4:37 ` Zhouping Liu 2012-07-03 7:41 ` Caspar Zhang @ 2012-07-03 8:03 ` Jan Stancek 2012-07-03 8:43 ` Zhouping Liu 2012-07-10 10:37 ` Caspar Zhang 2 siblings, 1 reply; 13+ messages in thread From: Jan Stancek @ 2012-07-03 8:03 UTC (permalink / raw) To: Zhouping Liu; +Cc: LTP List, CAI Qian ----- Original Message ----- > From: "Zhouping Liu" <zliu@redhat.com> > To: gaowanlong@cn.fujitsu.com > Cc: "LTP List" <ltp-list@lists.sourceforge.net>, "Jan Stancek" <jstancek@redhat.com>, "Caspar Zhang" > <caspar@casparzhang.com>, "CAI Qian" <caiqian@redhat.com> > Sent: Friday, 29 June, 2012 6:37:19 AM > Subject: Re: [LTP] [PATCH] mm/oom05: new testcase > > Hi, > > ----- Original Message ----- > > From: "Wanlong Gao" <gaowanlong@cn.fujitsu.com> > > To: "Zhouping Liu" <zliu@redhat.com> > > Cc: "LTP List" <ltp-list@lists.sourceforge.net>, "Jan Stancek" > > <jstancek@redhat.com> > > Sent: Friday, June 29, 2012 10:39:57 AM > > Subject: Re: [LTP] [PATCH] mm/oom05: new testcase > > > > On 06/29/2012 10:23 AM, Zhouping Liu wrote: > > > Hi, > > > > > > ----- Original Message ----- > > >> From: "Zhouping Liu" <zliu@redhat.com> > > >> To: "LTP List" <ltp-list@lists.sourceforge.net> > > >> Sent: Tuesday, June 26, 2012 11:57:35 PM > > >> Subject: [LTP] [PATCH] mm/oom05: new testcase > > >> > > >> add a new testcase to test OOM on each NUMA node > > > > > > I have tested it in several systems with 2 NUMA nodes and 8 NUMA > > > nodes, > > > they are all good, any comment? > > > > > > Thanks, > > > Zhouping > > > > > >> > > >> Signed-off-by: Zhouping Liu <zliu@redhat.com> > > >> --- > > >> runtest/mm | 1 + > > >> testcases/kernel/mem/oom/oom05.c | 131 > > >> ++++++++++++++++++++++++++++++++++++++ > > >> 2 files changed, 132 insertions(+) > > >> create mode 100644 testcases/kernel/mem/oom/oom05.c > > >> > > >> diff --git a/runtest/mm b/runtest/mm > > >> index 2dd66f0..a60c04b 100644 > > >> --- a/runtest/mm > > >> +++ b/runtest/mm > > >> @@ -77,6 +77,7 @@ oom01 oom01 > > >> oom02 oom02 > > >> oom03 oom03 > > >> oom04 oom04 > > >> +oom05 oom05 > > >> > > >> swapping01 swapping01 -i 5 > > >> > > >> diff --git a/testcases/kernel/mem/oom/oom05.c > > >> b/testcases/kernel/mem/oom/oom05.c > > >> new file mode 100644 > > >> index 0000000..046ddbb > > >> --- /dev/null > > >> +++ b/testcases/kernel/mem/oom/oom05.c > > >> @@ -0,0 +1,131 @@ > > >> +/* > > >> + * Out Of Memory (OOM) on Each NUMA nodes > > >> + * > > >> + * The program is designed to cope with unpredictable like > > >> amount > > >> and > > >> + * system physical memory, swap size and other VMM technology > > >> like > > >> KSM, > > >> + * memcg, memory hotplug and so on which may affect the OOM > > >> + * behaviours. It simply increase the memory consumption 3G > > >> each > > >> time > > >> + * until all the available memory is consumed and OOM is > > >> triggered. > > >> + * > > >> + * Copyright (C) 2012 Red Hat, Inc. > > >> + * This program is free software; you can redistribute it > > >> and/or > > >> + * modify it under the terms of version 2 of the GNU General > > >> Public > > >> + * License as published by the Free Software Foundation. > > >> + * > > >> + * This program is distributed in the hope that it would be > > >> useful, > > >> + * but WITHOUT ANY WARRANTY; without even the implied warranty > > >> of > > >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > >> + * > > >> + * Further, this software is distributed without any warranty > > >> that > > >> it > > >> + * is free of the rightful claim of any third person regarding > > >> + * infringement or the like. Any license provided herein, > > >> whether > > >> + * implied or otherwise, applies only to this software file. > > >> Patent > > >> + * licenses, if any, provided herein do not apply to > > >> combinations > > >> of > > >> + * this program with other software, or any other product > > >> whatsoever. > > >> + * > > >> + * You should have received a copy of the GNU General Public > > >> License > > >> + * along with this program; if not, write the Free Software > > >> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > > >> MA > > >> + * 02110-1301, USA. > > >> + */ > > >> +#include <sys/types.h> > > >> +#include <sys/stat.h> > > >> +#include <sys/wait.h> > > >> +#include <errno.h> > > >> +#include <fcntl.h> > > >> +#include <stdio.h> > > >> +#include <stdlib.h> > > >> +#include <unistd.h> > > >> +#include "test.h" > > >> +#include "safe_macros.h" > > >> +#include "usctest.h" > > >> +#include "mem.h" > > >> + > > >> +char *TCID = "oom05"; > > >> +int TST_TOTAL = 1; > > >> + > > >> +#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \ > > >> + && HAVE_MPOL_CONSTANTS > > >> +#include <numa.h> > > >> +#include <numaif.h> > > >> + > > >> +int main(int argc, char *argv[]) > > >> +{ > > >> + char *msg; > > >> + int lc; > > >> + long nodes[MAXNODES]; > > >> + int nnodes, i; > > >> + pid_t pids[MAXNODES]; > > >> + int status; > > >> + unsigned long nmasks[MAXNODES]; > > >> + > > >> + msg = parse_opts(argc, argv, NULL, NULL); > > >> + if (msg != NULL) > > >> + tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); > > >> + > > >> +#if __WORDSIZE == 32 > > >> + tst_brkm(TCONF, NULL, "test is not designed for 32-bit > > >> system."); > > >> +#endif > > >> + nnodes = count_numa(nodes); > > >> + if (nnodes <= 1) > > >> + tst_brkm(TCONF, NULL, "required a NUMA system."); > > >> + > > >> + setup(); > > >> + > > >> + set_sys_tune("overcommit_memory", 1, 1); > > >> + > > >> + for (lc = 0; TEST_LOOPING(lc); lc++) { > > >> + Tst_count = 0; > > >> + > > >> + for (i = 0; i < nnodes; i++) { > > >> + nmasks[i] = 1 << nodes[i]; > > >> + switch (pids[i] = fork()) { > > >> + case -1: > > >> + tst_brkm(TBROK|TERRNO, cleanup, "fork"); > > >> + case 0: > > >> + if (set_mempolicy(MPOL_BIND, &nmasks[i], > > >> + MAXNODES) == -1) > > >> + tst_brkm(TBROK|TERRNO, cleanup, > > >> + "set_mempolicy"); > > >> + tst_resm(TINFO, "start oom on numa node%lu", > > >> + nodes[i]); > > >> + oom(NORMAL, 0, 0); > > >> + exit(0); > > >> + } > > >> + } > > > > Hi Zhouping, > > > > Does it need get_allowed_nodes() that Jan added? > > > > yes, I met some errors when the system has unbalance NUMA system: > > the follow test machine has 2 numa nodes 0-1, I offline all node1's > cpu > # echo 0 > /sys/devices/system/node1/cpu*/online > > then you will find node1 don't contain any available cpus: > > # numactl -H > available: 2 nodes (0-1) > node 0 cpus: 0 1 2 3 > node 0 size: 4084 MB > node 0 free: 2929 MB > node 1 cpus: > node 1 size: 4096 MB > node 1 free: 3949 MB > node distances: > node 0 1 > 0: 10 21 > 1: 21 10 > > under such above setup, oom[2|4] will failed: > > ... > oom02 0 TINFO : process cpuset. > oom02 1 TBROK : write /dev/cpuset/1/cpuset.cpus: > errno=EINVAL(22): Invalid argument > oom02 2 TBROK : Remaining cases broken > oom02 0 TINFO : set overcommit_memory to 0 > oom02 0 TWARN : umount /dev/cpuset: errno=EBUSY(16): Device > or resource busy > oom02 0 TWARN : rmdir /dev/cpuset: errno=EBUSY(16): Device > or resource busy > > the failure is because node1 didn't have available cpus, but it tried > to write node1's cpus to /dev/cpuset/1/cpuset.cpus. > > and I tested get_allowed_nodes(), it didn't fix the error, > with above setup, I expected get_allowed_nodes_arr() can mark node1 > is a unavailable node, > but in actual it didn't, and it's the similar with count_numa() > inside testcase/kernel/mem/lib/mem.c. > so, Jan, do you have any thoughts to avoid the issues? if > get-allowed_nodes* can fix these issues, I also suggest we can > define them in ltp/include/numa_helper.h or other file name, > comments? Zhouping, Are other tests, such as move_pages also failing on this setup? Regards, Jan > > Thansk, > Zhuoping > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [LTP] [PATCH] mm/oom05: new testcase 2012-07-03 8:03 ` Jan Stancek @ 2012-07-03 8:43 ` Zhouping Liu 2012-07-03 8:55 ` Wanlong Gao 2012-07-03 9:27 ` Jan Stancek 0 siblings, 2 replies; 13+ messages in thread From: Zhouping Liu @ 2012-07-03 8:43 UTC (permalink / raw) To: Jan Stancek; +Cc: LTP List, CAI Qian ----- Original Message ----- > From: "Jan Stancek" <jstancek@redhat.com> > To: "Zhouping Liu" <zliu@redhat.com> > Cc: "LTP List" <ltp-list@lists.sourceforge.net>, "Caspar Zhang" <caspar@casparzhang.com>, "CAI Qian" > <caiqian@redhat.com>, gaowanlong@cn.fujitsu.com > Sent: Tuesday, July 3, 2012 4:03:00 PM > Subject: Re: [LTP] [PATCH] mm/oom05: new testcase > > > > ----- Original Message ----- > > From: "Zhouping Liu" <zliu@redhat.com> > > To: gaowanlong@cn.fujitsu.com > > Cc: "LTP List" <ltp-list@lists.sourceforge.net>, "Jan Stancek" > > <jstancek@redhat.com>, "Caspar Zhang" > > <caspar@casparzhang.com>, "CAI Qian" <caiqian@redhat.com> > > Sent: Friday, 29 June, 2012 6:37:19 AM > > Subject: Re: [LTP] [PATCH] mm/oom05: new testcase > > > > Hi, > > > > ----- Original Message ----- > > > From: "Wanlong Gao" <gaowanlong@cn.fujitsu.com> > > > To: "Zhouping Liu" <zliu@redhat.com> > > > Cc: "LTP List" <ltp-list@lists.sourceforge.net>, "Jan Stancek" > > > <jstancek@redhat.com> > > > Sent: Friday, June 29, 2012 10:39:57 AM > > > Subject: Re: [LTP] [PATCH] mm/oom05: new testcase > > > > > > On 06/29/2012 10:23 AM, Zhouping Liu wrote: > > > > Hi, > > > > > > > > ----- Original Message ----- > > > >> From: "Zhouping Liu" <zliu@redhat.com> > > > >> To: "LTP List" <ltp-list@lists.sourceforge.net> > > > >> Sent: Tuesday, June 26, 2012 11:57:35 PM > > > >> Subject: [LTP] [PATCH] mm/oom05: new testcase > > > >> > > > >> add a new testcase to test OOM on each NUMA node > > > > > > > > I have tested it in several systems with 2 NUMA nodes and 8 > > > > NUMA > > > > nodes, > > > > they are all good, any comment? > > > > > > > > Thanks, > > > > Zhouping > > > > > > > >> > > > >> Signed-off-by: Zhouping Liu <zliu@redhat.com> > > > >> --- > > > >> runtest/mm | 1 + > > > >> testcases/kernel/mem/oom/oom05.c | 131 > > > >> ++++++++++++++++++++++++++++++++++++++ > > > >> 2 files changed, 132 insertions(+) > > > >> create mode 100644 testcases/kernel/mem/oom/oom05.c > > > >> > > > >> diff --git a/runtest/mm b/runtest/mm > > > >> index 2dd66f0..a60c04b 100644 > > > >> --- a/runtest/mm > > > >> +++ b/runtest/mm > > > >> @@ -77,6 +77,7 @@ oom01 oom01 > > > >> oom02 oom02 > > > >> oom03 oom03 > > > >> oom04 oom04 > > > >> +oom05 oom05 > > > >> > > > >> swapping01 swapping01 -i 5 > > > >> > > > >> diff --git a/testcases/kernel/mem/oom/oom05.c > > > >> b/testcases/kernel/mem/oom/oom05.c > > > >> new file mode 100644 > > > >> index 0000000..046ddbb > > > >> --- /dev/null > > > >> +++ b/testcases/kernel/mem/oom/oom05.c > > > >> @@ -0,0 +1,131 @@ > > > >> +/* > > > >> + * Out Of Memory (OOM) on Each NUMA nodes > > > >> + * > > > >> + * The program is designed to cope with unpredictable like > > > >> amount > > > >> and > > > >> + * system physical memory, swap size and other VMM technology > > > >> like > > > >> KSM, > > > >> + * memcg, memory hotplug and so on which may affect the OOM > > > >> + * behaviours. It simply increase the memory consumption 3G > > > >> each > > > >> time > > > >> + * until all the available memory is consumed and OOM is > > > >> triggered. > > > >> + * > > > >> + * Copyright (C) 2012 Red Hat, Inc. > > > >> + * This program is free software; you can redistribute it > > > >> and/or > > > >> + * modify it under the terms of version 2 of the GNU General > > > >> Public > > > >> + * License as published by the Free Software Foundation. > > > >> + * > > > >> + * This program is distributed in the hope that it would be > > > >> useful, > > > >> + * but WITHOUT ANY WARRANTY; without even the implied > > > >> warranty > > > >> of > > > >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > > >> + * > > > >> + * Further, this software is distributed without any warranty > > > >> that > > > >> it > > > >> + * is free of the rightful claim of any third person > > > >> regarding > > > >> + * infringement or the like. Any license provided herein, > > > >> whether > > > >> + * implied or otherwise, applies only to this software file. > > > >> Patent > > > >> + * licenses, if any, provided herein do not apply to > > > >> combinations > > > >> of > > > >> + * this program with other software, or any other product > > > >> whatsoever. > > > >> + * > > > >> + * You should have received a copy of the GNU General Public > > > >> License > > > >> + * along with this program; if not, write the Free Software > > > >> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > > > >> MA > > > >> + * 02110-1301, USA. > > > >> + */ > > > >> +#include <sys/types.h> > > > >> +#include <sys/stat.h> > > > >> +#include <sys/wait.h> > > > >> +#include <errno.h> > > > >> +#include <fcntl.h> > > > >> +#include <stdio.h> > > > >> +#include <stdlib.h> > > > >> +#include <unistd.h> > > > >> +#include "test.h" > > > >> +#include "safe_macros.h" > > > >> +#include "usctest.h" > > > >> +#include "mem.h" > > > >> + > > > >> +char *TCID = "oom05"; > > > >> +int TST_TOTAL = 1; > > > >> + > > > >> +#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \ > > > >> + && HAVE_MPOL_CONSTANTS > > > >> +#include <numa.h> > > > >> +#include <numaif.h> > > > >> + > > > >> +int main(int argc, char *argv[]) > > > >> +{ > > > >> + char *msg; > > > >> + int lc; > > > >> + long nodes[MAXNODES]; > > > >> + int nnodes, i; > > > >> + pid_t pids[MAXNODES]; > > > >> + int status; > > > >> + unsigned long nmasks[MAXNODES]; > > > >> + > > > >> + msg = parse_opts(argc, argv, NULL, NULL); > > > >> + if (msg != NULL) > > > >> + tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); > > > >> + > > > >> +#if __WORDSIZE == 32 > > > >> + tst_brkm(TCONF, NULL, "test is not designed for 32-bit > > > >> system."); > > > >> +#endif > > > >> + nnodes = count_numa(nodes); > > > >> + if (nnodes <= 1) > > > >> + tst_brkm(TCONF, NULL, "required a NUMA system."); > > > >> + > > > >> + setup(); > > > >> + > > > >> + set_sys_tune("overcommit_memory", 1, 1); > > > >> + > > > >> + for (lc = 0; TEST_LOOPING(lc); lc++) { > > > >> + Tst_count = 0; > > > >> + > > > >> + for (i = 0; i < nnodes; i++) { > > > >> + nmasks[i] = 1 << nodes[i]; > > > >> + switch (pids[i] = fork()) { > > > >> + case -1: > > > >> + tst_brkm(TBROK|TERRNO, cleanup, "fork"); > > > >> + case 0: > > > >> + if (set_mempolicy(MPOL_BIND, &nmasks[i], > > > >> + MAXNODES) == -1) > > > >> + tst_brkm(TBROK|TERRNO, cleanup, > > > >> + "set_mempolicy"); > > > >> + tst_resm(TINFO, "start oom on numa node%lu", > > > >> + nodes[i]); > > > >> + oom(NORMAL, 0, 0); > > > >> + exit(0); > > > >> + } > > > >> + } > > > > > > Hi Zhouping, > > > > > > Does it need get_allowed_nodes() that Jan added? > > > > > > > yes, I met some errors when the system has unbalance NUMA system: > > > > the follow test machine has 2 numa nodes 0-1, I offline all node1's > > cpu > > # echo 0 > /sys/devices/system/node1/cpu*/online > > > > then you will find node1 don't contain any available cpus: > > > > # numactl -H > > available: 2 nodes (0-1) > > node 0 cpus: 0 1 2 3 > > node 0 size: 4084 MB > > node 0 free: 2929 MB > > node 1 cpus: > > node 1 size: 4096 MB > > node 1 free: 3949 MB > > node distances: > > node 0 1 > > 0: 10 21 > > 1: 21 10 > > > > under such above setup, oom[2|4] will failed: > > > > ... > > oom02 0 TINFO : process cpuset. > > oom02 1 TBROK : write /dev/cpuset/1/cpuset.cpus: > > errno=EINVAL(22): Invalid argument > > oom02 2 TBROK : Remaining cases broken > > oom02 0 TINFO : set overcommit_memory to 0 > > oom02 0 TWARN : umount /dev/cpuset: errno=EBUSY(16): > > Device > > or resource busy > > oom02 0 TWARN : rmdir /dev/cpuset: errno=EBUSY(16): Device > > or resource busy > > > > the failure is because node1 didn't have available cpus, but it > > tried > > to write node1's cpus to /dev/cpuset/1/cpuset.cpus. > > > > and I tested get_allowed_nodes(), it didn't fix the error, > > with above setup, I expected get_allowed_nodes_arr() can mark node1 > > is a unavailable node, > > but in actual it didn't, and it's the similar with count_numa() > > inside testcase/kernel/mem/lib/mem.c. > > so, Jan, do you have any thoughts to avoid the issues? if > > get-allowed_nodes* can fix these issues, I also suggest we can > > define them in ltp/include/numa_helper.h or other file name, > > comments? > > Zhouping, > > Are other tests, such as move_pages also failing on this setup? no, I tested move_pages* on the setup, all passed, so this setup didn't affect move_pages. but it blocked oom0[2|4] & ksm0[2|4] cases, I will prepare a patch for it, BTW, I'm interested in the various different NUMA setups in previous mail[1], I'm not sure these setups are faked or real, if they are faked, could you tell me how you can setup? (I have only one NUMA machine in my hands, and it's an normal one, if I can imitate more special NUMA setup, it will be big help for me to test other cases. and I tried kernel cmdline 'numa=fake=N', but I couldn't get what I expected, so please share your ideas if you have different methods, many thanks!) [1] http://sourceforge.net/mailarchive/forum.php?thread_name=4FC48906.6030109%40redhat.com&forum_name=ltp-list Thanks, Zhouping ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [LTP] [PATCH] mm/oom05: new testcase 2012-07-03 8:43 ` Zhouping Liu @ 2012-07-03 8:55 ` Wanlong Gao 2012-07-03 9:27 ` Jan Stancek 1 sibling, 0 replies; 13+ messages in thread From: Wanlong Gao @ 2012-07-03 8:55 UTC (permalink / raw) To: Zhouping Liu; +Cc: LTP List, CAI Qian On 07/03/2012 04:43 PM, Zhouping Liu wrote: > > > ----- Original Message ----- >> From: "Jan Stancek" <jstancek@redhat.com> >> To: "Zhouping Liu" <zliu@redhat.com> >> Cc: "LTP List" <ltp-list@lists.sourceforge.net>, "Caspar Zhang" <caspar@casparzhang.com>, "CAI Qian" >> <caiqian@redhat.com>, gaowanlong@cn.fujitsu.com >> Sent: Tuesday, July 3, 2012 4:03:00 PM >> Subject: Re: [LTP] [PATCH] mm/oom05: new testcase >> >> >> >> ----- Original Message ----- >>> From: "Zhouping Liu" <zliu@redhat.com> >>> To: gaowanlong@cn.fujitsu.com >>> Cc: "LTP List" <ltp-list@lists.sourceforge.net>, "Jan Stancek" >>> <jstancek@redhat.com>, "Caspar Zhang" >>> <caspar@casparzhang.com>, "CAI Qian" <caiqian@redhat.com> >>> Sent: Friday, 29 June, 2012 6:37:19 AM >>> Subject: Re: [LTP] [PATCH] mm/oom05: new testcase >>> >>> Hi, >>> >>> ----- Original Message ----- >>>> From: "Wanlong Gao" <gaowanlong@cn.fujitsu.com> >>>> To: "Zhouping Liu" <zliu@redhat.com> >>>> Cc: "LTP List" <ltp-list@lists.sourceforge.net>, "Jan Stancek" >>>> <jstancek@redhat.com> >>>> Sent: Friday, June 29, 2012 10:39:57 AM >>>> Subject: Re: [LTP] [PATCH] mm/oom05: new testcase >>>> >>>> On 06/29/2012 10:23 AM, Zhouping Liu wrote: >>>>> Hi, >>>>> >>>>> ----- Original Message ----- >>>>>> From: "Zhouping Liu" <zliu@redhat.com> >>>>>> To: "LTP List" <ltp-list@lists.sourceforge.net> >>>>>> Sent: Tuesday, June 26, 2012 11:57:35 PM >>>>>> Subject: [LTP] [PATCH] mm/oom05: new testcase >>>>>> >>>>>> add a new testcase to test OOM on each NUMA node >>>>> >>>>> I have tested it in several systems with 2 NUMA nodes and 8 >>>>> NUMA >>>>> nodes, >>>>> they are all good, any comment? >>>>> >>>>> Thanks, >>>>> Zhouping >>>>> >>>>>> >>>>>> Signed-off-by: Zhouping Liu <zliu@redhat.com> >>>>>> --- >>>>>> runtest/mm | 1 + >>>>>> testcases/kernel/mem/oom/oom05.c | 131 >>>>>> ++++++++++++++++++++++++++++++++++++++ >>>>>> 2 files changed, 132 insertions(+) >>>>>> create mode 100644 testcases/kernel/mem/oom/oom05.c >>>>>> >>>>>> diff --git a/runtest/mm b/runtest/mm >>>>>> index 2dd66f0..a60c04b 100644 >>>>>> --- a/runtest/mm >>>>>> +++ b/runtest/mm >>>>>> @@ -77,6 +77,7 @@ oom01 oom01 >>>>>> oom02 oom02 >>>>>> oom03 oom03 >>>>>> oom04 oom04 >>>>>> +oom05 oom05 >>>>>> >>>>>> swapping01 swapping01 -i 5 >>>>>> >>>>>> diff --git a/testcases/kernel/mem/oom/oom05.c >>>>>> b/testcases/kernel/mem/oom/oom05.c >>>>>> new file mode 100644 >>>>>> index 0000000..046ddbb >>>>>> --- /dev/null >>>>>> +++ b/testcases/kernel/mem/oom/oom05.c >>>>>> @@ -0,0 +1,131 @@ >>>>>> +/* >>>>>> + * Out Of Memory (OOM) on Each NUMA nodes >>>>>> + * >>>>>> + * The program is designed to cope with unpredictable like >>>>>> amount >>>>>> and >>>>>> + * system physical memory, swap size and other VMM technology >>>>>> like >>>>>> KSM, >>>>>> + * memcg, memory hotplug and so on which may affect the OOM >>>>>> + * behaviours. It simply increase the memory consumption 3G >>>>>> each >>>>>> time >>>>>> + * until all the available memory is consumed and OOM is >>>>>> triggered. >>>>>> + * >>>>>> + * Copyright (C) 2012 Red Hat, Inc. >>>>>> + * This program is free software; you can redistribute it >>>>>> and/or >>>>>> + * modify it under the terms of version 2 of the GNU General >>>>>> Public >>>>>> + * License as published by the Free Software Foundation. >>>>>> + * >>>>>> + * This program is distributed in the hope that it would be >>>>>> useful, >>>>>> + * but WITHOUT ANY WARRANTY; without even the implied >>>>>> warranty >>>>>> of >>>>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. >>>>>> + * >>>>>> + * Further, this software is distributed without any warranty >>>>>> that >>>>>> it >>>>>> + * is free of the rightful claim of any third person >>>>>> regarding >>>>>> + * infringement or the like. Any license provided herein, >>>>>> whether >>>>>> + * implied or otherwise, applies only to this software file. >>>>>> Patent >>>>>> + * licenses, if any, provided herein do not apply to >>>>>> combinations >>>>>> of >>>>>> + * this program with other software, or any other product >>>>>> whatsoever. >>>>>> + * >>>>>> + * You should have received a copy of the GNU General Public >>>>>> License >>>>>> + * along with this program; if not, write the Free Software >>>>>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, >>>>>> MA >>>>>> + * 02110-1301, USA. >>>>>> + */ >>>>>> +#include <sys/types.h> >>>>>> +#include <sys/stat.h> >>>>>> +#include <sys/wait.h> >>>>>> +#include <errno.h> >>>>>> +#include <fcntl.h> >>>>>> +#include <stdio.h> >>>>>> +#include <stdlib.h> >>>>>> +#include <unistd.h> >>>>>> +#include "test.h" >>>>>> +#include "safe_macros.h" >>>>>> +#include "usctest.h" >>>>>> +#include "mem.h" >>>>>> + >>>>>> +char *TCID = "oom05"; >>>>>> +int TST_TOTAL = 1; >>>>>> + >>>>>> +#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \ >>>>>> + && HAVE_MPOL_CONSTANTS >>>>>> +#include <numa.h> >>>>>> +#include <numaif.h> >>>>>> + >>>>>> +int main(int argc, char *argv[]) >>>>>> +{ >>>>>> + char *msg; >>>>>> + int lc; >>>>>> + long nodes[MAXNODES]; >>>>>> + int nnodes, i; >>>>>> + pid_t pids[MAXNODES]; >>>>>> + int status; >>>>>> + unsigned long nmasks[MAXNODES]; >>>>>> + >>>>>> + msg = parse_opts(argc, argv, NULL, NULL); >>>>>> + if (msg != NULL) >>>>>> + tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); >>>>>> + >>>>>> +#if __WORDSIZE == 32 >>>>>> + tst_brkm(TCONF, NULL, "test is not designed for 32-bit >>>>>> system."); >>>>>> +#endif >>>>>> + nnodes = count_numa(nodes); >>>>>> + if (nnodes <= 1) >>>>>> + tst_brkm(TCONF, NULL, "required a NUMA system."); >>>>>> + >>>>>> + setup(); >>>>>> + >>>>>> + set_sys_tune("overcommit_memory", 1, 1); >>>>>> + >>>>>> + for (lc = 0; TEST_LOOPING(lc); lc++) { >>>>>> + Tst_count = 0; >>>>>> + >>>>>> + for (i = 0; i < nnodes; i++) { >>>>>> + nmasks[i] = 1 << nodes[i]; >>>>>> + switch (pids[i] = fork()) { >>>>>> + case -1: >>>>>> + tst_brkm(TBROK|TERRNO, cleanup, "fork"); >>>>>> + case 0: >>>>>> + if (set_mempolicy(MPOL_BIND, &nmasks[i], >>>>>> + MAXNODES) == -1) >>>>>> + tst_brkm(TBROK|TERRNO, cleanup, >>>>>> + "set_mempolicy"); >>>>>> + tst_resm(TINFO, "start oom on numa node%lu", >>>>>> + nodes[i]); >>>>>> + oom(NORMAL, 0, 0); >>>>>> + exit(0); >>>>>> + } >>>>>> + } >>>> >>>> Hi Zhouping, >>>> >>>> Does it need get_allowed_nodes() that Jan added? >>>> >>> >>> yes, I met some errors when the system has unbalance NUMA system: >>> >>> the follow test machine has 2 numa nodes 0-1, I offline all node1's >>> cpu >>> # echo 0 > /sys/devices/system/node1/cpu*/online >>> >>> then you will find node1 don't contain any available cpus: >>> >>> # numactl -H >>> available: 2 nodes (0-1) >>> node 0 cpus: 0 1 2 3 >>> node 0 size: 4084 MB >>> node 0 free: 2929 MB >>> node 1 cpus: >>> node 1 size: 4096 MB >>> node 1 free: 3949 MB >>> node distances: >>> node 0 1 >>> 0: 10 21 >>> 1: 21 10 >>> >>> under such above setup, oom[2|4] will failed: >>> >>> ... >>> oom02 0 TINFO : process cpuset. >>> oom02 1 TBROK : write /dev/cpuset/1/cpuset.cpus: >>> errno=EINVAL(22): Invalid argument >>> oom02 2 TBROK : Remaining cases broken >>> oom02 0 TINFO : set overcommit_memory to 0 >>> oom02 0 TWARN : umount /dev/cpuset: errno=EBUSY(16): >>> Device >>> or resource busy >>> oom02 0 TWARN : rmdir /dev/cpuset: errno=EBUSY(16): Device >>> or resource busy >>> >>> the failure is because node1 didn't have available cpus, but it >>> tried >>> to write node1's cpus to /dev/cpuset/1/cpuset.cpus. >>> >>> and I tested get_allowed_nodes(), it didn't fix the error, >>> with above setup, I expected get_allowed_nodes_arr() can mark node1 >>> is a unavailable node, >>> but in actual it didn't, and it's the similar with count_numa() >>> inside testcase/kernel/mem/lib/mem.c. >>> so, Jan, do you have any thoughts to avoid the issues? if >>> get-allowed_nodes* can fix these issues, I also suggest we can >>> define them in ltp/include/numa_helper.h or other file name, >>> comments? >> >> Zhouping, >> >> Are other tests, such as move_pages also failing on this setup? > > no, I tested move_pages* on the setup, all passed, so this setup didn't affect move_pages. > but it blocked oom0[2|4] & ksm0[2|4] cases, I will prepare a patch for it, > > BTW, I'm interested in the various different NUMA setups in previous mail[1], > I'm not sure these setups are faked or real, if they are faked, could you tell me > how you can setup? (I have only one NUMA machine in my hands, and it's an normal one, > if I can imitate more special NUMA setup, it will be big help for me to test other cases. > and I tried kernel cmdline 'numa=fake=N', but I couldn't get what I expected, > so please share your ideas if you have different methods, many thanks!) Maybe you can use qemu-kvm to emulator one numa machine? Wanlong Gao > > [1] http://sourceforge.net/mailarchive/forum.php?thread_name=4FC48906.6030109%40redhat.com&forum_name=ltp-list > > Thanks, > Zhouping > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [LTP] [PATCH] mm/oom05: new testcase 2012-07-03 8:43 ` Zhouping Liu 2012-07-03 8:55 ` Wanlong Gao @ 2012-07-03 9:27 ` Jan Stancek 1 sibling, 0 replies; 13+ messages in thread From: Jan Stancek @ 2012-07-03 9:27 UTC (permalink / raw) To: Zhouping Liu; +Cc: LTP List, CAI Qian ----- Original Message ----- > From: "Zhouping Liu" <zliu@redhat.com> > To: "Jan Stancek" <jstancek@redhat.com> > Cc: "LTP List" <ltp-list@lists.sourceforge.net>, "Caspar Zhang" <caspar@casparzhang.com>, "CAI Qian" > <caiqian@redhat.com>, gaowanlong@cn.fujitsu.com > Sent: Tuesday, 3 July, 2012 10:43:35 AM > Subject: Re: [LTP] [PATCH] mm/oom05: new testcase > > > Zhouping, > > > > Are other tests, such as move_pages also failing on this setup? > > no, I tested move_pages* on the setup, all passed, so this setup > didn't affect move_pages. > but it blocked oom0[2|4] & ksm0[2|4] cases, I will prepare a patch > for it, > So, we have tests with different expectation when node is 'available'. Some are happy with memory being available, others want associated cpus. numa_node_to_cpus() is likely what we need. We can either make new function, or add some flag to existing one, depending on flag it would return nodes with available memory/cpus or both. > BTW, I'm interested in the various different NUMA setups in previous > mail[1], > I'm not sure these setups are faked or real, if they are faked, could > you tell me > how you can setup? (I have only one NUMA machine in my hands, and > it's an normal one, > if I can imitate more special NUMA setup, it will be big help for me > to test other cases. > and I tried kernel cmdline 'numa=fake=N', but I couldn't get what I > expected, > so please share your ideas if you have different methods, many > thanks!) 2,4,5 were real 1 and 3 were fake with CONFIG_NUMA_EMU=Y and patched kernel to allow zero-size nodes. I ran that as KVM guest with kernel params "numa=fake=2*0,1*512" # numactl -H available: 2 nodes (2-3) node 2 cpus: 0 node 2 size: 511 MB node 2 free: 33 MB node 3 cpus: node 3 size: 511 MB node 3 free: 102 MB I can't find the patch, but it was quite simple so I can recreate it if needed. Regards, Jan > > [1] > http://sourceforge.net/mailarchive/forum.php?thread_name=4FC48906.6030109%40redhat.com&forum_name=ltp-list > > Thanks, > Zhouping > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [LTP] [PATCH] mm/oom05: new testcase 2012-06-29 4:37 ` Zhouping Liu 2012-07-03 7:41 ` Caspar Zhang 2012-07-03 8:03 ` Jan Stancek @ 2012-07-10 10:37 ` Caspar Zhang 2012-07-10 10:49 ` Jan Stancek 2 siblings, 1 reply; 13+ messages in thread From: Caspar Zhang @ 2012-07-10 10:37 UTC (permalink / raw) To: Zhouping Liu; +Cc: LTP List, CAI Qian On 06/29/2012 12:37 PM, Zhouping Liu wrote: > Hi, > > ----- Original Message ----- >> From: "Wanlong Gao" <gaowanlong@cn.fujitsu.com> >> To: "Zhouping Liu" <zliu@redhat.com> >> Cc: "LTP List" <ltp-list@lists.sourceforge.net>, "Jan Stancek" <jstancek@redhat.com> >> Sent: Friday, June 29, 2012 10:39:57 AM >> Subject: Re: [LTP] [PATCH] mm/oom05: new testcase >> >> On 06/29/2012 10:23 AM, Zhouping Liu wrote: >>> Hi, >>> >>> ----- Original Message ----- >>>> From: "Zhouping Liu" <zliu@redhat.com> >>>> To: "LTP List" <ltp-list@lists.sourceforge.net> >>>> Sent: Tuesday, June 26, 2012 11:57:35 PM >>>> Subject: [LTP] [PATCH] mm/oom05: new testcase >>>> >>>> add a new testcase to test OOM on each NUMA node >>> >>> I have tested it in several systems with 2 NUMA nodes and 8 NUMA >>> nodes, >>> they are all good, any comment? >>> >>> Thanks, >>> Zhouping >>> >>>> >>>> Signed-off-by: Zhouping Liu <zliu@redhat.com> >>>> --- >>>> runtest/mm | 1 + >>>> testcases/kernel/mem/oom/oom05.c | 131 >>>> ++++++++++++++++++++++++++++++++++++++ >>>> 2 files changed, 132 insertions(+) >>>> create mode 100644 testcases/kernel/mem/oom/oom05.c >>>> >>>> diff --git a/runtest/mm b/runtest/mm >>>> index 2dd66f0..a60c04b 100644 >>>> --- a/runtest/mm >>>> +++ b/runtest/mm >>>> @@ -77,6 +77,7 @@ oom01 oom01 >>>> oom02 oom02 >>>> oom03 oom03 >>>> oom04 oom04 >>>> +oom05 oom05 >>>> >>>> swapping01 swapping01 -i 5 >>>> >>>> diff --git a/testcases/kernel/mem/oom/oom05.c >>>> b/testcases/kernel/mem/oom/oom05.c >>>> new file mode 100644 >>>> index 0000000..046ddbb >>>> --- /dev/null >>>> +++ b/testcases/kernel/mem/oom/oom05.c >>>> @@ -0,0 +1,131 @@ >>>> +/* >>>> + * Out Of Memory (OOM) on Each NUMA nodes >>>> + * >>>> + * The program is designed to cope with unpredictable like amount >>>> and >>>> + * system physical memory, swap size and other VMM technology >>>> like >>>> KSM, >>>> + * memcg, memory hotplug and so on which may affect the OOM >>>> + * behaviours. It simply increase the memory consumption 3G each >>>> time >>>> + * until all the available memory is consumed and OOM is >>>> triggered. >>>> + * >>>> + * Copyright (C) 2012 Red Hat, Inc. >>>> + * This program is free software; you can redistribute it and/or >>>> + * modify it under the terms of version 2 of the GNU General >>>> Public >>>> + * License as published by the Free Software Foundation. >>>> + * >>>> + * This program is distributed in the hope that it would be >>>> useful, >>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. >>>> + * >>>> + * Further, this software is distributed without any warranty >>>> that >>>> it >>>> + * is free of the rightful claim of any third person regarding >>>> + * infringement or the like. Any license provided herein, >>>> whether >>>> + * implied or otherwise, applies only to this software file. >>>> Patent >>>> + * licenses, if any, provided herein do not apply to combinations >>>> of >>>> + * this program with other software, or any other product >>>> whatsoever. >>>> + * >>>> + * You should have received a copy of the GNU General Public >>>> License >>>> + * along with this program; if not, write the Free Software >>>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA >>>> + * 02110-1301, USA. >>>> + */ >>>> +#include <sys/types.h> >>>> +#include <sys/stat.h> >>>> +#include <sys/wait.h> >>>> +#include <errno.h> >>>> +#include <fcntl.h> >>>> +#include <stdio.h> >>>> +#include <stdlib.h> >>>> +#include <unistd.h> >>>> +#include "test.h" >>>> +#include "safe_macros.h" >>>> +#include "usctest.h" >>>> +#include "mem.h" >>>> + >>>> +char *TCID = "oom05"; >>>> +int TST_TOTAL = 1; >>>> + >>>> +#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \ >>>> + && HAVE_MPOL_CONSTANTS >>>> +#include <numa.h> >>>> +#include <numaif.h> >>>> + >>>> +int main(int argc, char *argv[]) >>>> +{ >>>> + char *msg; >>>> + int lc; >>>> + long nodes[MAXNODES]; >>>> + int nnodes, i; >>>> + pid_t pids[MAXNODES]; >>>> + int status; >>>> + unsigned long nmasks[MAXNODES]; >>>> + >>>> + msg = parse_opts(argc, argv, NULL, NULL); >>>> + if (msg != NULL) >>>> + tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); >>>> + >>>> +#if __WORDSIZE == 32 >>>> + tst_brkm(TCONF, NULL, "test is not designed for 32-bit >>>> system."); >>>> +#endif >>>> + nnodes = count_numa(nodes); >>>> + if (nnodes <= 1) >>>> + tst_brkm(TCONF, NULL, "required a NUMA system."); >>>> + >>>> + setup(); >>>> + >>>> + set_sys_tune("overcommit_memory", 1, 1); >>>> + >>>> + for (lc = 0; TEST_LOOPING(lc); lc++) { >>>> + Tst_count = 0; >>>> + >>>> + for (i = 0; i < nnodes; i++) { >>>> + nmasks[i] = 1 << nodes[i]; >>>> + switch (pids[i] = fork()) { >>>> + case -1: >>>> + tst_brkm(TBROK|TERRNO, cleanup, "fork"); >>>> + case 0: >>>> + if (set_mempolicy(MPOL_BIND, &nmasks[i], >>>> + MAXNODES) == -1) >>>> + tst_brkm(TBROK|TERRNO, cleanup, >>>> + "set_mempolicy"); >>>> + tst_resm(TINFO, "start oom on numa node%lu", >>>> + nodes[i]); >>>> + oom(NORMAL, 0, 0); >>>> + exit(0); >>>> + } >>>> + } >> >> Hi Zhouping, >> >> Does it need get_allowed_nodes() that Jan added? >> > > yes, I met some errors when the system has unbalance NUMA system: > > the follow test machine has 2 numa nodes 0-1, I offline all node1's cpu > # echo 0 > /sys/devices/system/node1/cpu*/online > > then you will find node1 don't contain any available cpus: > > # numactl -H > available: 2 nodes (0-1) > node 0 cpus: 0 1 2 3 > node 0 size: 4084 MB > node 0 free: 2929 MB > node 1 cpus: > node 1 size: 4096 MB > node 1 free: 3949 MB > node distances: > node 0 1 > 0: 10 21 > 1: 21 10 > > under such above setup, oom[2|4] will failed: > > ... > oom02 0 TINFO : process cpuset. > oom02 1 TBROK : write /dev/cpuset/1/cpuset.cpus: errno=EINVAL(22): Invalid argument > oom02 2 TBROK : Remaining cases broken > oom02 0 TINFO : set overcommit_memory to 0 > oom02 0 TWARN : umount /dev/cpuset: errno=EBUSY(16): Device or resource busy > oom02 0 TWARN : rmdir /dev/cpuset: errno=EBUSY(16): Device or resource busy > > the failure is because node1 didn't have available cpus, but it tried to write node1's cpus to /dev/cpuset/1/cpuset.cpus. > > and I tested get_allowed_nodes(), it didn't fix the error, > with above setup, I expected get_allowed_nodes_arr() can mark node1 is a unavailable node, > but in actual it didn't, and it's the similar with count_numa() inside testcase/kernel/mem/lib/mem.c. > so, Jan, do you have any thoughts to avoid the issues? if get-allowed_nodes* can fix these issues, I also suggest we can > define them in ltp/include/numa_helper.h or other file name, comments? Looks like get_allowed_nodes* functions only check allowed memories, but doesn't check cpus, maybe adding a numa_node_to_cpus() check can solve this? Thanks, Caspar ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [LTP] [PATCH] mm/oom05: new testcase 2012-07-10 10:37 ` Caspar Zhang @ 2012-07-10 10:49 ` Jan Stancek 2012-07-10 11:05 ` Caspar Zhang 0 siblings, 1 reply; 13+ messages in thread From: Jan Stancek @ 2012-07-10 10:49 UTC (permalink / raw) To: Caspar Zhang; +Cc: LTP List, CAI Qian ----- Original Message ----- > From: "Caspar Zhang" <caspar@casparzhang.com> > To: "Zhouping Liu" <zliu@redhat.com> > Cc: gaowanlong@cn.fujitsu.com, "LTP List" <ltp-list@lists.sourceforge.net>, "Jan Stancek" <jstancek@redhat.com>, "CAI > Qian" <caiqian@redhat.com> > Sent: Tuesday, 10 July, 2012 12:37:10 PM > Subject: Re: [LTP] [PATCH] mm/oom05: new testcase > > On 06/29/2012 12:37 PM, Zhouping Liu wrote: > > Hi, > > > > ----- Original Message ----- > >> From: "Wanlong Gao" <gaowanlong@cn.fujitsu.com> > >> To: "Zhouping Liu" <zliu@redhat.com> > >> Cc: "LTP List" <ltp-list@lists.sourceforge.net>, "Jan Stancek" > >> <jstancek@redhat.com> > >> Sent: Friday, June 29, 2012 10:39:57 AM > >> Subject: Re: [LTP] [PATCH] mm/oom05: new testcase > >> > >> On 06/29/2012 10:23 AM, Zhouping Liu wrote: > >>> Hi, > >>> > >>> ----- Original Message ----- > >>>> From: "Zhouping Liu" <zliu@redhat.com> > >>>> To: "LTP List" <ltp-list@lists.sourceforge.net> > >>>> Sent: Tuesday, June 26, 2012 11:57:35 PM > >>>> Subject: [LTP] [PATCH] mm/oom05: new testcase > >>>> > >>>> add a new testcase to test OOM on each NUMA node > >>> > >>> I have tested it in several systems with 2 NUMA nodes and 8 NUMA > >>> nodes, > >>> they are all good, any comment? > >>> > >>> Thanks, > >>> Zhouping > >>> > >>>> > >>>> Signed-off-by: Zhouping Liu <zliu@redhat.com> > >>>> --- > >>>> runtest/mm | 1 + > >>>> testcases/kernel/mem/oom/oom05.c | 131 > >>>> ++++++++++++++++++++++++++++++++++++++ > >>>> 2 files changed, 132 insertions(+) > >>>> create mode 100644 testcases/kernel/mem/oom/oom05.c > >>>> > >>>> diff --git a/runtest/mm b/runtest/mm > >>>> index 2dd66f0..a60c04b 100644 > >>>> --- a/runtest/mm > >>>> +++ b/runtest/mm > >>>> @@ -77,6 +77,7 @@ oom01 oom01 > >>>> oom02 oom02 > >>>> oom03 oom03 > >>>> oom04 oom04 > >>>> +oom05 oom05 > >>>> > >>>> swapping01 swapping01 -i 5 > >>>> > >>>> diff --git a/testcases/kernel/mem/oom/oom05.c > >>>> b/testcases/kernel/mem/oom/oom05.c > >>>> new file mode 100644 > >>>> index 0000000..046ddbb > >>>> --- /dev/null > >>>> +++ b/testcases/kernel/mem/oom/oom05.c > >>>> @@ -0,0 +1,131 @@ > >>>> +/* > >>>> + * Out Of Memory (OOM) on Each NUMA nodes > >>>> + * > >>>> + * The program is designed to cope with unpredictable like > >>>> amount > >>>> and > >>>> + * system physical memory, swap size and other VMM technology > >>>> like > >>>> KSM, > >>>> + * memcg, memory hotplug and so on which may affect the OOM > >>>> + * behaviours. It simply increase the memory consumption 3G > >>>> each > >>>> time > >>>> + * until all the available memory is consumed and OOM is > >>>> triggered. > >>>> + * > >>>> + * Copyright (C) 2012 Red Hat, Inc. > >>>> + * This program is free software; you can redistribute it > >>>> and/or > >>>> + * modify it under the terms of version 2 of the GNU General > >>>> Public > >>>> + * License as published by the Free Software Foundation. > >>>> + * > >>>> + * This program is distributed in the hope that it would be > >>>> useful, > >>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty > >>>> of > >>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > >>>> + * > >>>> + * Further, this software is distributed without any warranty > >>>> that > >>>> it > >>>> + * is free of the rightful claim of any third person regarding > >>>> + * infringement or the like. Any license provided herein, > >>>> whether > >>>> + * implied or otherwise, applies only to this software file. > >>>> Patent > >>>> + * licenses, if any, provided herein do not apply to > >>>> combinations > >>>> of > >>>> + * this program with other software, or any other product > >>>> whatsoever. > >>>> + * > >>>> + * You should have received a copy of the GNU General Public > >>>> License > >>>> + * along with this program; if not, write the Free Software > >>>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > >>>> MA > >>>> + * 02110-1301, USA. > >>>> + */ > >>>> +#include <sys/types.h> > >>>> +#include <sys/stat.h> > >>>> +#include <sys/wait.h> > >>>> +#include <errno.h> > >>>> +#include <fcntl.h> > >>>> +#include <stdio.h> > >>>> +#include <stdlib.h> > >>>> +#include <unistd.h> > >>>> +#include "test.h" > >>>> +#include "safe_macros.h" > >>>> +#include "usctest.h" > >>>> +#include "mem.h" > >>>> + > >>>> +char *TCID = "oom05"; > >>>> +int TST_TOTAL = 1; > >>>> + > >>>> +#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \ > >>>> + && HAVE_MPOL_CONSTANTS > >>>> +#include <numa.h> > >>>> +#include <numaif.h> > >>>> + > >>>> +int main(int argc, char *argv[]) > >>>> +{ > >>>> + char *msg; > >>>> + int lc; > >>>> + long nodes[MAXNODES]; > >>>> + int nnodes, i; > >>>> + pid_t pids[MAXNODES]; > >>>> + int status; > >>>> + unsigned long nmasks[MAXNODES]; > >>>> + > >>>> + msg = parse_opts(argc, argv, NULL, NULL); > >>>> + if (msg != NULL) > >>>> + tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); > >>>> + > >>>> +#if __WORDSIZE == 32 > >>>> + tst_brkm(TCONF, NULL, "test is not designed for 32-bit > >>>> system."); > >>>> +#endif > >>>> + nnodes = count_numa(nodes); > >>>> + if (nnodes <= 1) > >>>> + tst_brkm(TCONF, NULL, "required a NUMA system."); > >>>> + > >>>> + setup(); > >>>> + > >>>> + set_sys_tune("overcommit_memory", 1, 1); > >>>> + > >>>> + for (lc = 0; TEST_LOOPING(lc); lc++) { > >>>> + Tst_count = 0; > >>>> + > >>>> + for (i = 0; i < nnodes; i++) { > >>>> + nmasks[i] = 1 << nodes[i]; > >>>> + switch (pids[i] = fork()) { > >>>> + case -1: > >>>> + tst_brkm(TBROK|TERRNO, cleanup, "fork"); > >>>> + case 0: > >>>> + if (set_mempolicy(MPOL_BIND, &nmasks[i], > >>>> + MAXNODES) == -1) > >>>> + tst_brkm(TBROK|TERRNO, cleanup, > >>>> + "set_mempolicy"); > >>>> + tst_resm(TINFO, "start oom on numa node%lu", > >>>> + nodes[i]); > >>>> + oom(NORMAL, 0, 0); > >>>> + exit(0); > >>>> + } > >>>> + } > >> > >> Hi Zhouping, > >> > >> Does it need get_allowed_nodes() that Jan added? > >> > > > > yes, I met some errors when the system has unbalance NUMA system: > > > > the follow test machine has 2 numa nodes 0-1, I offline all node1's > > cpu > > # echo 0 > /sys/devices/system/node1/cpu*/online > > > > then you will find node1 don't contain any available cpus: > > > > # numactl -H > > available: 2 nodes (0-1) > > node 0 cpus: 0 1 2 3 > > node 0 size: 4084 MB > > node 0 free: 2929 MB > > node 1 cpus: > > node 1 size: 4096 MB > > node 1 free: 3949 MB > > node distances: > > node 0 1 > > 0: 10 21 > > 1: 21 10 > > > > under such above setup, oom[2|4] will failed: > > > > ... > > oom02 0 TINFO : process cpuset. > > oom02 1 TBROK : write /dev/cpuset/1/cpuset.cpus: > > errno=EINVAL(22): Invalid argument > > oom02 2 TBROK : Remaining cases broken > > oom02 0 TINFO : set overcommit_memory to 0 > > oom02 0 TWARN : umount /dev/cpuset: errno=EBUSY(16): > > Device or resource busy > > oom02 0 TWARN : rmdir /dev/cpuset: errno=EBUSY(16): Device > > or resource busy > > > > the failure is because node1 didn't have available cpus, but it > > tried to write node1's cpus to /dev/cpuset/1/cpuset.cpus. > > > > and I tested get_allowed_nodes(), it didn't fix the error, > > with above setup, I expected get_allowed_nodes_arr() can mark node1 > > is a unavailable node, > > but in actual it didn't, and it's the similar with count_numa() > > inside testcase/kernel/mem/lib/mem.c. > > so, Jan, do you have any thoughts to avoid the issues? if > > get-allowed_nodes* can fix these issues, I also suggest we can > > define them in ltp/include/numa_helper.h or other file name, > > comments? > > Looks like get_allowed_nodes* functions only check allowed memories, > but > doesn't check cpus, maybe adding a numa_node_to_cpus() check can > solve this? I was thinking the same: http://article.gmane.org/gmane.linux.ltp/16348 but considering, if we apply that everywhere or introduce some kind of flag, so the test could specify what nodes it is interested in (memory/cpu/both). Regards, Jan > > Thanks, > Caspar > > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [LTP] [PATCH] mm/oom05: new testcase 2012-07-10 10:49 ` Jan Stancek @ 2012-07-10 11:05 ` Caspar Zhang 0 siblings, 0 replies; 13+ messages in thread From: Caspar Zhang @ 2012-07-10 11:05 UTC (permalink / raw) To: Jan Stancek; +Cc: LTP List, CAI Qian On 07/10/2012 06:49 PM, Jan Stancek wrote: > > > ----- Original Message ----- >> From: "Caspar Zhang" <caspar@casparzhang.com> >> To: "Zhouping Liu" <zliu@redhat.com> >> Cc: gaowanlong@cn.fujitsu.com, "LTP List" <ltp-list@lists.sourceforge.net>, "Jan Stancek" <jstancek@redhat.com>, "CAI >> Qian" <caiqian@redhat.com> >> Sent: Tuesday, 10 July, 2012 12:37:10 PM >> Subject: Re: [LTP] [PATCH] mm/oom05: new testcase >> >> On 06/29/2012 12:37 PM, Zhouping Liu wrote: >>> Hi, >>> >>> ----- Original Message ----- >>>> From: "Wanlong Gao" <gaowanlong@cn.fujitsu.com> >>>> To: "Zhouping Liu" <zliu@redhat.com> >>>> Cc: "LTP List" <ltp-list@lists.sourceforge.net>, "Jan Stancek" >>>> <jstancek@redhat.com> >>>> Sent: Friday, June 29, 2012 10:39:57 AM >>>> Subject: Re: [LTP] [PATCH] mm/oom05: new testcase >>>> >>>> On 06/29/2012 10:23 AM, Zhouping Liu wrote: >>>>> Hi, >>>>> >>>>> ----- Original Message ----- >>>>>> From: "Zhouping Liu" <zliu@redhat.com> >>>>>> To: "LTP List" <ltp-list@lists.sourceforge.net> >>>>>> Sent: Tuesday, June 26, 2012 11:57:35 PM >>>>>> Subject: [LTP] [PATCH] mm/oom05: new testcase >>>>>> >>>>>> add a new testcase to test OOM on each NUMA node >>>>> >>>>> I have tested it in several systems with 2 NUMA nodes and 8 NUMA >>>>> nodes, >>>>> they are all good, any comment? >>>>> >>>>> Thanks, >>>>> Zhouping >>>>> >>>>>> >>>>>> Signed-off-by: Zhouping Liu <zliu@redhat.com> >>>>>> --- >>>>>> runtest/mm | 1 + >>>>>> testcases/kernel/mem/oom/oom05.c | 131 >>>>>> ++++++++++++++++++++++++++++++++++++++ >>>>>> 2 files changed, 132 insertions(+) >>>>>> create mode 100644 testcases/kernel/mem/oom/oom05.c >>>>>> >>>>>> diff --git a/runtest/mm b/runtest/mm >>>>>> index 2dd66f0..a60c04b 100644 >>>>>> --- a/runtest/mm >>>>>> +++ b/runtest/mm >>>>>> @@ -77,6 +77,7 @@ oom01 oom01 >>>>>> oom02 oom02 >>>>>> oom03 oom03 >>>>>> oom04 oom04 >>>>>> +oom05 oom05 >>>>>> >>>>>> swapping01 swapping01 -i 5 >>>>>> >>>>>> diff --git a/testcases/kernel/mem/oom/oom05.c >>>>>> b/testcases/kernel/mem/oom/oom05.c >>>>>> new file mode 100644 >>>>>> index 0000000..046ddbb >>>>>> --- /dev/null >>>>>> +++ b/testcases/kernel/mem/oom/oom05.c >>>>>> @@ -0,0 +1,131 @@ >>>>>> +/* >>>>>> + * Out Of Memory (OOM) on Each NUMA nodes >>>>>> + * >>>>>> + * The program is designed to cope with unpredictable like >>>>>> amount >>>>>> and >>>>>> + * system physical memory, swap size and other VMM technology >>>>>> like >>>>>> KSM, >>>>>> + * memcg, memory hotplug and so on which may affect the OOM >>>>>> + * behaviours. It simply increase the memory consumption 3G >>>>>> each >>>>>> time >>>>>> + * until all the available memory is consumed and OOM is >>>>>> triggered. >>>>>> + * >>>>>> + * Copyright (C) 2012 Red Hat, Inc. >>>>>> + * This program is free software; you can redistribute it >>>>>> and/or >>>>>> + * modify it under the terms of version 2 of the GNU General >>>>>> Public >>>>>> + * License as published by the Free Software Foundation. >>>>>> + * >>>>>> + * This program is distributed in the hope that it would be >>>>>> useful, >>>>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty >>>>>> of >>>>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. >>>>>> + * >>>>>> + * Further, this software is distributed without any warranty >>>>>> that >>>>>> it >>>>>> + * is free of the rightful claim of any third person regarding >>>>>> + * infringement or the like. Any license provided herein, >>>>>> whether >>>>>> + * implied or otherwise, applies only to this software file. >>>>>> Patent >>>>>> + * licenses, if any, provided herein do not apply to >>>>>> combinations >>>>>> of >>>>>> + * this program with other software, or any other product >>>>>> whatsoever. >>>>>> + * >>>>>> + * You should have received a copy of the GNU General Public >>>>>> License >>>>>> + * along with this program; if not, write the Free Software >>>>>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, >>>>>> MA >>>>>> + * 02110-1301, USA. >>>>>> + */ >>>>>> +#include <sys/types.h> >>>>>> +#include <sys/stat.h> >>>>>> +#include <sys/wait.h> >>>>>> +#include <errno.h> >>>>>> +#include <fcntl.h> >>>>>> +#include <stdio.h> >>>>>> +#include <stdlib.h> >>>>>> +#include <unistd.h> >>>>>> +#include "test.h" >>>>>> +#include "safe_macros.h" >>>>>> +#include "usctest.h" >>>>>> +#include "mem.h" >>>>>> + >>>>>> +char *TCID = "oom05"; >>>>>> +int TST_TOTAL = 1; >>>>>> + >>>>>> +#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \ >>>>>> + && HAVE_MPOL_CONSTANTS >>>>>> +#include <numa.h> >>>>>> +#include <numaif.h> >>>>>> + >>>>>> +int main(int argc, char *argv[]) >>>>>> +{ >>>>>> + char *msg; >>>>>> + int lc; >>>>>> + long nodes[MAXNODES]; >>>>>> + int nnodes, i; >>>>>> + pid_t pids[MAXNODES]; >>>>>> + int status; >>>>>> + unsigned long nmasks[MAXNODES]; >>>>>> + >>>>>> + msg = parse_opts(argc, argv, NULL, NULL); >>>>>> + if (msg != NULL) >>>>>> + tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); >>>>>> + >>>>>> +#if __WORDSIZE == 32 >>>>>> + tst_brkm(TCONF, NULL, "test is not designed for 32-bit >>>>>> system."); >>>>>> +#endif >>>>>> + nnodes = count_numa(nodes); >>>>>> + if (nnodes <= 1) >>>>>> + tst_brkm(TCONF, NULL, "required a NUMA system."); >>>>>> + >>>>>> + setup(); >>>>>> + >>>>>> + set_sys_tune("overcommit_memory", 1, 1); >>>>>> + >>>>>> + for (lc = 0; TEST_LOOPING(lc); lc++) { >>>>>> + Tst_count = 0; >>>>>> + >>>>>> + for (i = 0; i < nnodes; i++) { >>>>>> + nmasks[i] = 1 << nodes[i]; >>>>>> + switch (pids[i] = fork()) { >>>>>> + case -1: >>>>>> + tst_brkm(TBROK|TERRNO, cleanup, "fork"); >>>>>> + case 0: >>>>>> + if (set_mempolicy(MPOL_BIND, &nmasks[i], >>>>>> + MAXNODES) == -1) >>>>>> + tst_brkm(TBROK|TERRNO, cleanup, >>>>>> + "set_mempolicy"); >>>>>> + tst_resm(TINFO, "start oom on numa node%lu", >>>>>> + nodes[i]); >>>>>> + oom(NORMAL, 0, 0); >>>>>> + exit(0); >>>>>> + } >>>>>> + } >>>> >>>> Hi Zhouping, >>>> >>>> Does it need get_allowed_nodes() that Jan added? >>>> >>> >>> yes, I met some errors when the system has unbalance NUMA system: >>> >>> the follow test machine has 2 numa nodes 0-1, I offline all node1's >>> cpu >>> # echo 0 > /sys/devices/system/node1/cpu*/online >>> >>> then you will find node1 don't contain any available cpus: >>> >>> # numactl -H >>> available: 2 nodes (0-1) >>> node 0 cpus: 0 1 2 3 >>> node 0 size: 4084 MB >>> node 0 free: 2929 MB >>> node 1 cpus: >>> node 1 size: 4096 MB >>> node 1 free: 3949 MB >>> node distances: >>> node 0 1 >>> 0: 10 21 >>> 1: 21 10 >>> >>> under such above setup, oom[2|4] will failed: >>> >>> ... >>> oom02 0 TINFO : process cpuset. >>> oom02 1 TBROK : write /dev/cpuset/1/cpuset.cpus: >>> errno=EINVAL(22): Invalid argument >>> oom02 2 TBROK : Remaining cases broken >>> oom02 0 TINFO : set overcommit_memory to 0 >>> oom02 0 TWARN : umount /dev/cpuset: errno=EBUSY(16): >>> Device or resource busy >>> oom02 0 TWARN : rmdir /dev/cpuset: errno=EBUSY(16): Device >>> or resource busy >>> >>> the failure is because node1 didn't have available cpus, but it >>> tried to write node1's cpus to /dev/cpuset/1/cpuset.cpus. >>> >>> and I tested get_allowed_nodes(), it didn't fix the error, >>> with above setup, I expected get_allowed_nodes_arr() can mark node1 >>> is a unavailable node, >>> but in actual it didn't, and it's the similar with count_numa() >>> inside testcase/kernel/mem/lib/mem.c. >>> so, Jan, do you have any thoughts to avoid the issues? if >>> get-allowed_nodes* can fix these issues, I also suggest we can >>> define them in ltp/include/numa_helper.h or other file name, >>> comments? >> >> Looks like get_allowed_nodes* functions only check allowed memories, >> but >> doesn't check cpus, maybe adding a numa_node_to_cpus() check can >> solve this? > > I was thinking the same: > http://article.gmane.org/gmane.linux.ltp/16348 oops... my eyes just skipped this post! > > but considering, if we apply that everywhere or introduce some kind of flag, > so the test could specify what nodes it is interested in (memory/cpu/both). it sounds a good idea to me if we allow the test to choose checking memory, cpu or both. Thanks, Caspar ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [LTP] [PATCH] mm/oom05: new testcase 2012-06-29 2:39 ` Wanlong Gao 2012-06-29 4:37 ` Zhouping Liu @ 2012-06-29 7:33 ` Jan Stancek 1 sibling, 0 replies; 13+ messages in thread From: Jan Stancek @ 2012-06-29 7:33 UTC (permalink / raw) To: gaowanlong; +Cc: LTP List ----- Original Message ----- > From: "Wanlong Gao" <gaowanlong@cn.fujitsu.com> > To: "Zhouping Liu" <zliu@redhat.com> > Cc: "LTP List" <ltp-list@lists.sourceforge.net>, "Jan Stancek" <jstancek@redhat.com> > Sent: Friday, 29 June, 2012 4:39:57 AM > Subject: Re: [LTP] [PATCH] mm/oom05: new testcase > > On 06/29/2012 10:23 AM, Zhouping Liu wrote: > > Hi, > > > > ----- Original Message ----- > >> From: "Zhouping Liu" <zliu@redhat.com> > >> To: "LTP List" <ltp-list@lists.sourceforge.net> > >> Sent: Tuesday, June 26, 2012 11:57:35 PM > >> Subject: [LTP] [PATCH] mm/oom05: new testcase > >> > >> add a new testcase to test OOM on each NUMA node > > > > I have tested it in several systems with 2 NUMA nodes and 8 NUMA > > nodes, > > they are all good, any comment? > > > > Thanks, > > Zhouping > > > >> > >> Signed-off-by: Zhouping Liu <zliu@redhat.com> > >> --- > >> runtest/mm | 1 + > >> testcases/kernel/mem/oom/oom05.c | 131 > >> ++++++++++++++++++++++++++++++++++++++ > >> 2 files changed, 132 insertions(+) > >> create mode 100644 testcases/kernel/mem/oom/oom05.c > >> > >> diff --git a/runtest/mm b/runtest/mm > >> index 2dd66f0..a60c04b 100644 > >> --- a/runtest/mm > >> +++ b/runtest/mm > >> @@ -77,6 +77,7 @@ oom01 oom01 > >> oom02 oom02 > >> oom03 oom03 > >> oom04 oom04 > >> +oom05 oom05 > >> > >> swapping01 swapping01 -i 5 > >> > >> diff --git a/testcases/kernel/mem/oom/oom05.c > >> b/testcases/kernel/mem/oom/oom05.c > >> new file mode 100644 > >> index 0000000..046ddbb > >> --- /dev/null > >> +++ b/testcases/kernel/mem/oom/oom05.c > >> @@ -0,0 +1,131 @@ > >> +/* > >> + * Out Of Memory (OOM) on Each NUMA nodes > >> + * > >> + * The program is designed to cope with unpredictable like amount > >> and > >> + * system physical memory, swap size and other VMM technology > >> like > >> KSM, > >> + * memcg, memory hotplug and so on which may affect the OOM > >> + * behaviours. It simply increase the memory consumption 3G each > >> time > >> + * until all the available memory is consumed and OOM is > >> triggered. > >> + * > >> + * Copyright (C) 2012 Red Hat, Inc. > >> + * This program is free software; you can redistribute it and/or > >> + * modify it under the terms of version 2 of the GNU General > >> Public > >> + * License as published by the Free Software Foundation. > >> + * > >> + * This program is distributed in the hope that it would be > >> useful, > >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of > >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > >> + * > >> + * Further, this software is distributed without any warranty > >> that > >> it > >> + * is free of the rightful claim of any third person regarding > >> + * infringement or the like. Any license provided herein, > >> whether > >> + * implied or otherwise, applies only to this software file. > >> Patent > >> + * licenses, if any, provided herein do not apply to combinations > >> of > >> + * this program with other software, or any other product > >> whatsoever. > >> + * > >> + * You should have received a copy of the GNU General Public > >> License > >> + * along with this program; if not, write the Free Software > >> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > >> + * 02110-1301, USA. > >> + */ > >> +#include <sys/types.h> > >> +#include <sys/stat.h> > >> +#include <sys/wait.h> > >> +#include <errno.h> > >> +#include <fcntl.h> > >> +#include <stdio.h> > >> +#include <stdlib.h> > >> +#include <unistd.h> > >> +#include "test.h" > >> +#include "safe_macros.h" > >> +#include "usctest.h" > >> +#include "mem.h" > >> + > >> +char *TCID = "oom05"; > >> +int TST_TOTAL = 1; > >> + > >> +#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \ > >> + && HAVE_MPOL_CONSTANTS > >> +#include <numa.h> > >> +#include <numaif.h> > >> + > >> +int main(int argc, char *argv[]) > >> +{ > >> + char *msg; > >> + int lc; > >> + long nodes[MAXNODES]; > >> + int nnodes, i; > >> + pid_t pids[MAXNODES]; > >> + int status; > >> + unsigned long nmasks[MAXNODES]; > >> + > >> + msg = parse_opts(argc, argv, NULL, NULL); > >> + if (msg != NULL) > >> + tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); > >> + > >> +#if __WORDSIZE == 32 > >> + tst_brkm(TCONF, NULL, "test is not designed for 32-bit > >> system."); > >> +#endif > >> + nnodes = count_numa(nodes); > >> + if (nnodes <= 1) > >> + tst_brkm(TCONF, NULL, "required a NUMA system."); > >> + > >> + setup(); > >> + > >> + set_sys_tune("overcommit_memory", 1, 1); > >> + > >> + for (lc = 0; TEST_LOOPING(lc); lc++) { > >> + Tst_count = 0; > >> + > >> + for (i = 0; i < nnodes; i++) { > >> + nmasks[i] = 1 << nodes[i]; > >> + switch (pids[i] = fork()) { > >> + case -1: > >> + tst_brkm(TBROK|TERRNO, cleanup, "fork"); > >> + case 0: > >> + if (set_mempolicy(MPOL_BIND, &nmasks[i], > >> + MAXNODES) == -1) > >> + tst_brkm(TBROK|TERRNO, cleanup, > >> + "set_mempolicy"); > >> + tst_resm(TINFO, "start oom on numa node%lu", > >> + nodes[i]); > >> + oom(NORMAL, 0, 0); > >> + exit(0); > >> + } > >> + } > > Hi Zhouping, > > Does it need get_allowed_nodes() that Jan added? count_numa goes over nodes in /sys/devices/system/node/, so I'm guessing it will find 2 nodes on this setup: 4. # numactl -H available: 2 nodes (0-1) node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 node 0 size: 0 MB node 0 free: 0 MB node 1 cpus: node 1 size: 12288 MB node 1 free: 9689 MB node distances: node 0 1 0: 10 40 1: 40 10 I'll provision that host and check it. Regards, Jan > > Thanks, > Wanlong Gao > > >> + > >> + for (i = 0; i < nnodes; i++) { > >> + if (waitpid(pids[i], &status, WUNTRACED|WCONTINUED) == -1) > >> + tst_brkm(TBROK|TERRNO, cleanup, "waitpid"); > >> + > >> + if (WIFEXITED(status) && WEXITSTATUS(status) != 0) > >> + tst_resm(TFAIL, "child[%d] exit with " > >> + "status: %d", pids[i], status); > >> + } > >> + } > >> + cleanup(); > >> + tst_exit(); > >> +} > >> + > >> +void setup(void) > >> +{ > >> + tst_require_root(NULL); > >> + tst_sig(FORK, DEF_HANDLER, cleanup); > >> + TEST_PAUSE; > >> + > >> + overcommit = get_sys_tune("overcommit_memory"); > >> +} > >> + > >> +void cleanup(void) > >> +{ > >> + set_sys_tune("overcommit_memory", overcommit, 0); > >> + > >> + TEST_CLEANUP; > >> +} > >> + > >> +#else /* no NUMA */ > >> +int main(void) > >> +{ > >> + tst_brkm(TCONF, NULL, "no NUMA development packages > >> installed."); > >> +} > >> +#endif > >> -- > >> 1.7.10.2 > >> > >> > >> ------------------------------------------------------------------------------ > >> Live Security Virtual Conference > >> Exclusive live event will cover all the ways today's security and > >> threat landscape has changed and how IT managers can respond. > >> Discussions > >> will include endpoint security, mobile security and the latest in > >> malware > >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > >> _______________________________________________ > >> Ltp-list mailing list > >> Ltp-list@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/ltp-list > >> > > > > > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2012-07-10 11:06 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-06-26 15:57 [LTP] [PATCH] mm/oom05: new testcase Zhouping Liu 2012-06-29 2:23 ` Zhouping Liu 2012-06-29 2:39 ` Wanlong Gao 2012-06-29 4:37 ` Zhouping Liu 2012-07-03 7:41 ` Caspar Zhang 2012-07-03 8:03 ` Jan Stancek 2012-07-03 8:43 ` Zhouping Liu 2012-07-03 8:55 ` Wanlong Gao 2012-07-03 9:27 ` Jan Stancek 2012-07-10 10:37 ` Caspar Zhang 2012-07-10 10:49 ` Jan Stancek 2012-07-10 11:05 ` Caspar Zhang 2012-06-29 7:33 ` Jan Stancek
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox