All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak inspection
@ 2014-12-27  7:13 Li Wang
  2014-12-30  9:23 ` Jan Stancek
  0 siblings, 1 reply; 13+ messages in thread
From: Li Wang @ 2014-12-27  7:13 UTC (permalink / raw)
  To: ltp-list

Description of Problem:
    When over 1GB shared memory was alocated in hugepage, the hugepage
    is not released though process finished.

Signed-off-by: Li Wang <liwang@redhat.com>
---
 runtest/hugetlb                                    |   1 +
 testcases/kernel/mem/.gitignore                    |   1 +
 .../kernel/mem/hugetlb/hugeshmat/hugeshmat04.c     | 185 +++++++++++++++++++++
 3 files changed, 187 insertions(+)
 create mode 100644 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c

diff --git a/runtest/hugetlb b/runtest/hugetlb
index 3eaf14c..805141d 100644
--- a/runtest/hugetlb
+++ b/runtest/hugetlb
@@ -10,6 +10,7 @@ hugemmap05_3 hugemmap05 -s -m
 hugeshmat01 hugeshmat01 -i 5
 hugeshmat02 hugeshmat02 -i 5
 hugeshmat03 hugeshmat03 -i 5
+hugeshmat04 hugeshamt04 -i 5
 
 hugeshmctl01 hugeshmctl01 -i 5
 hugeshmctl02 hugeshmctl02 -i 5
diff --git a/testcases/kernel/mem/.gitignore b/testcases/kernel/mem/.gitignore
index f96964c..c531563 100644
--- a/testcases/kernel/mem/.gitignore
+++ b/testcases/kernel/mem/.gitignore
@@ -6,6 +6,7 @@
 /hugetlb/hugeshmat/hugeshmat01
 /hugetlb/hugeshmat/hugeshmat02
 /hugetlb/hugeshmat/hugeshmat03
+/hugetlb/hugeshmat/hugeshmat04
 /hugetlb/hugeshmctl/hugeshmctl01
 /hugetlb/hugeshmctl/hugeshmctl02
 /hugetlb/hugeshmctl/hugeshmctl03
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
new file mode 100644
index 0000000..515947b
--- /dev/null
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
@@ -0,0 +1,185 @@
+/*
+ *   Copyright (c) Linux Test Project, 2014
+ *
+ *   This program is free software;  you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ *   the GNU General Public License for more details.
+ *  
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program;  if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * 	hugeshmat04.c
+ * 
+ * DESCRIPTION
+ *	hugeshmat04 - test for hugepage leak inspection.
+ *     
+ *      Description of Problem:
+ *          When over 1GB shered memory was alocated in hugepage, the hugepage
+ *          is not released though process finished.
+ *
+ *          You need more than 2GB memory in test job
+ *
+ *	Return value:
+ *	  0: 	 Test successed.  No regression found.
+ *	  1: 	 Test failed.  Maybe memory shortage.  Please retry testing.
+ *	  2: 	 Test failed.  Regression detected.
+ *	  other: Test failed.  Other problem detected.
+ *
+ * HISTORY
+ * 	05/2014 - Written by Fujistu Corp. 
+ *     	12/2014 - Port to LTP by Li Wang.
+ *    
+ * RESTRICTIONS
+ * 	test must be run at root
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/shm.h>
+#include <sys/wait.h>
+
+#include "test.h"
+#include "mem.h"
+
+#define SIZE	(1024 * 1024 * 1024)
+#define BOUNDARY (1024 * 1024 * 1024)
+
+char *TCID = "hugeshmat04";
+int TST_TOTAL = 3;
+
+static int huge_total;
+static int huge_free;
+static int huge_free2;
+static long hugepages;
+static long orig_hugepages;
+
+static int shared_hugepage(void);
+
+
+int main(int ac, char **av)
+{
+	int lc, i, ret;
+	const char *msg;
+
+	msg = parse_opts(ac,av, NULL, NULL);
+	if (msg != NULL)
+		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+
+	setup();
+
+	for (lc = 0; TEST_LOOPING(lc); lc++) {
+		tst_count = 0;
+
+		for (i = 0; i < TST_TOTAL; i++) {
+			huge_total = read_meminfo("HugePages_Total:");
+			huge_free = read_meminfo("HugePages_Free:");
+
+			if (huge_total == hugepages && huge_free == hugepages) {
+				ret = shared_hugepage();
+
+				huge_free2 = read_meminfo("HugePages_Free:");
+				if (huge_free2 != huge_free)
+					ret = 2;
+			} else {
+				ret = 1;
+			}
+			
+			switch (ret) {
+			case 0:
+				tst_resm(TPASS, 
+					"No regression found.");
+				break;
+			case 1:
+				tst_brkm(TFAIL, cleanup, 
+					"Test failed. Maybe memory shortage.");
+				break;
+			case 2:
+				tst_brkm(TFAIL, cleanup, 
+					"Test failed. Hugepage leak inspection.");
+				break;
+			default:
+				tst_brkm(TFAIL, cleanup, 
+					"Test failed. Other problem detected.");
+				break;
+			}
+
+		}
+	}
+	cleanup();
+	tst_exit();
+}
+
+int shared_hugepage(void)
+{
+	pid_t pid;
+	int status, shmid;
+	size_t size = (size_t)SIZE;
+	void *buf;
+
+	shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | 0777);
+	if (shmid < 0)
+		tst_brkm(TBROK | TERRNO, cleanup, "shmget");
+
+	buf = shmat(shmid, (void *)BOUNDARY, SHM_RND | 0777);
+	if ( buf == (void *)-1 ) {
+		shmctl(shmid, IPC_RMID, NULL);
+		tst_brkm(TBROK | TERRNO, cleanup, "shmat");
+	}
+
+	memset(buf, 2, size);
+	sleep(3);
+	pid = fork();
+	
+	if (pid == 0)
+	        exit(1);
+	else if (pid < 0)
+	 	tst_brkm(TBROK | TERRNO, cleanup, "fork");
+	
+	wait(&status);
+	shmdt(buf);
+	shmctl(shmid, IPC_RMID, NULL);
+
+	return 0;
+}
+
+void setup(void)
+{
+	long mem_total, hpage_size;
+	
+	tst_require_root(NULL);
+
+	mem_total = read_meminfo("MemTotal:");
+	if (mem_total < 2097152) {
+		tst_resm(TINFO, "Total memory should greater than 2G.");
+		tst_exit();
+	}
+
+	orig_hugepages = get_sys_tune("nr_hugepages");
+	hpage_size = read_meminfo("Hugepagesize:");
+	
+	hugepages = (orig_hugepages * hpage_size + 1048576) / hpage_size;
+	set_sys_tune("nr_hugepages", hugepages, 1);
+	
+	TEST_PAUSE;
+}
+
+void cleanup(void)
+{
+	TEST_CLEANUP;
+	set_sys_tune("nr_hugepages", orig_hugepages, 0);
+}
-- 
1.8.3.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
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] mem/hugeshmat: new case for hugepage leak inspection
  2014-12-27  7:13 [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak inspection Li Wang
@ 2014-12-30  9:23 ` Jan Stancek
  2015-01-04  3:10   ` Li Wang
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Stancek @ 2014-12-30  9:23 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp-list





----- Original Message -----
> From: "Li Wang" <liwang@redhat.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Saturday, 27 December, 2014 8:13:06 AM
> Subject: [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak inspection
> 
> Description of Problem:
>     When over 1GB shared memory was alocated in hugepage, the hugepage
>     is not released though process finished.

This looks like a regression test for kernel bug. Do you know what
kernel version are affected and which commit is fixing it?

Regards,
Jan

> 
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
>  runtest/hugetlb                                    |   1 +
>  testcases/kernel/mem/.gitignore                    |   1 +
>  .../kernel/mem/hugetlb/hugeshmat/hugeshmat04.c     | 185
>  +++++++++++++++++++++
>  3 files changed, 187 insertions(+)
>  create mode 100644 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> 
> diff --git a/runtest/hugetlb b/runtest/hugetlb
> index 3eaf14c..805141d 100644
> --- a/runtest/hugetlb
> +++ b/runtest/hugetlb
> @@ -10,6 +10,7 @@ hugemmap05_3 hugemmap05 -s -m
>  hugeshmat01 hugeshmat01 -i 5
>  hugeshmat02 hugeshmat02 -i 5
>  hugeshmat03 hugeshmat03 -i 5
> +hugeshmat04 hugeshamt04 -i 5
>  
>  hugeshmctl01 hugeshmctl01 -i 5
>  hugeshmctl02 hugeshmctl02 -i 5
> diff --git a/testcases/kernel/mem/.gitignore
> b/testcases/kernel/mem/.gitignore
> index f96964c..c531563 100644
> --- a/testcases/kernel/mem/.gitignore
> +++ b/testcases/kernel/mem/.gitignore
> @@ -6,6 +6,7 @@
>  /hugetlb/hugeshmat/hugeshmat01
>  /hugetlb/hugeshmat/hugeshmat02
>  /hugetlb/hugeshmat/hugeshmat03
> +/hugetlb/hugeshmat/hugeshmat04
>  /hugetlb/hugeshmctl/hugeshmctl01
>  /hugetlb/hugeshmctl/hugeshmctl02
>  /hugetlb/hugeshmctl/hugeshmctl03
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> new file mode 100644
> index 0000000..515947b
> --- /dev/null
> +++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> @@ -0,0 +1,185 @@
> +/*
> + *   Copyright (c) Linux Test Project, 2014
> + *
> + *   This program is free software;  you can redistribute it and/or modify
> + *   it under the terms of the GNU General Public License as published by
> + *   the Free Software Foundation; either version 2 of the License, or
> + *   (at your option) any later version.
> + *
> + *   This program is distributed in the hope that it will be useful,
> + *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
> + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
> + *   the GNU General Public License for more details.
> + *
> + *   You should have received a copy of the GNU General Public License
> + *   along with this program;  if not, write to the Free Software
> + *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> + */
> +
> +/*
> + * NAME
> + * 	hugeshmat04.c
> + *
> + * DESCRIPTION
> + *	hugeshmat04 - test for hugepage leak inspection.
> + *
> + *      Description of Problem:
> + *          When over 1GB shered memory was alocated in hugepage, the
> hugepage
> + *          is not released though process finished.
> + *
> + *          You need more than 2GB memory in test job
> + *
> + *	Return value:
> + *	  0: 	 Test successed.  No regression found.
> + *	  1: 	 Test failed.  Maybe memory shortage.  Please retry testing.
> + *	  2: 	 Test failed.  Regression detected.
> + *	  other: Test failed.  Other problem detected.
> + *
> + * HISTORY
> + * 	05/2014 - Written by Fujistu Corp.
> + *     	12/2014 - Port to LTP by Li Wang.
> + *
> + * RESTRICTIONS
> + * 	test must be run at root
> + */
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <unistd.h>
> +#include <fcntl.h>
> +#include <string.h>
> +#include <sys/mman.h>
> +#include <sys/types.h>
> +#include <sys/shm.h>
> +#include <sys/wait.h>
> +
> +#include "test.h"
> +#include "mem.h"
> +
> +#define SIZE	(1024 * 1024 * 1024)
> +#define BOUNDARY (1024 * 1024 * 1024)
> +
> +char *TCID = "hugeshmat04";
> +int TST_TOTAL = 3;
> +
> +static int huge_total;
> +static int huge_free;
> +static int huge_free2;
> +static long hugepages;
> +static long orig_hugepages;
> +
> +static int shared_hugepage(void);
> +
> +
> +int main(int ac, char **av)
> +{
> +	int lc, i, ret;
> +	const char *msg;
> +
> +	msg = parse_opts(ac,av, NULL, NULL);
> +	if (msg != NULL)
> +		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
> +
> +	setup();
> +
> +	for (lc = 0; TEST_LOOPING(lc); lc++) {
> +		tst_count = 0;
> +
> +		for (i = 0; i < TST_TOTAL; i++) {
> +			huge_total = read_meminfo("HugePages_Total:");
> +			huge_free = read_meminfo("HugePages_Free:");
> +
> +			if (huge_total == hugepages && huge_free == hugepages) {
> +				ret = shared_hugepage();
> +
> +				huge_free2 = read_meminfo("HugePages_Free:");
> +				if (huge_free2 != huge_free)
> +					ret = 2;
> +			} else {
> +				ret = 1;
> +			}
> +
> +			switch (ret) {
> +			case 0:
> +				tst_resm(TPASS,
> +					"No regression found.");
> +				break;
> +			case 1:
> +				tst_brkm(TFAIL, cleanup,
> +					"Test failed. Maybe memory shortage.");
> +				break;
> +			case 2:
> +				tst_brkm(TFAIL, cleanup,
> +					"Test failed. Hugepage leak inspection.");
> +				break;
> +			default:
> +				tst_brkm(TFAIL, cleanup,
> +					"Test failed. Other problem detected.");
> +				break;
> +			}
> +
> +		}
> +	}
> +	cleanup();
> +	tst_exit();
> +}
> +
> +int shared_hugepage(void)
> +{
> +	pid_t pid;
> +	int status, shmid;
> +	size_t size = (size_t)SIZE;
> +	void *buf;
> +
> +	shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | 0777);
> +	if (shmid < 0)
> +		tst_brkm(TBROK | TERRNO, cleanup, "shmget");
> +
> +	buf = shmat(shmid, (void *)BOUNDARY, SHM_RND | 0777);
> +	if ( buf == (void *)-1 ) {
> +		shmctl(shmid, IPC_RMID, NULL);
> +		tst_brkm(TBROK | TERRNO, cleanup, "shmat");
> +	}
> +
> +	memset(buf, 2, size);
> +	sleep(3);
> +	pid = fork();
> +
> +	if (pid == 0)
> +	        exit(1);
> +	else if (pid < 0)
> +	 	tst_brkm(TBROK | TERRNO, cleanup, "fork");
> +
> +	wait(&status);
> +	shmdt(buf);
> +	shmctl(shmid, IPC_RMID, NULL);
> +
> +	return 0;
> +}
> +
> +void setup(void)
> +{
> +	long mem_total, hpage_size;
> +
> +	tst_require_root(NULL);
> +
> +	mem_total = read_meminfo("MemTotal:");
> +	if (mem_total < 2097152) {
> +		tst_resm(TINFO, "Total memory should greater than 2G.");
> +		tst_exit();
> +	}
> +
> +	orig_hugepages = get_sys_tune("nr_hugepages");
> +	hpage_size = read_meminfo("Hugepagesize:");
> +
> +	hugepages = (orig_hugepages * hpage_size + 1048576) / hpage_size;
> +	set_sys_tune("nr_hugepages", hugepages, 1);
> +
> +	TEST_PAUSE;
> +}
> +
> +void cleanup(void)
> +{
> +	TEST_CLEANUP;
> +	set_sys_tune("nr_hugepages", orig_hugepages, 0);
> +}
> --
> 1.8.3.1
> 
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming! The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
> 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
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] mem/hugeshmat: new case for hugepage leak inspection
  2014-12-30  9:23 ` Jan Stancek
@ 2015-01-04  3:10   ` Li Wang
  2015-01-05 10:16     ` Jan Stancek
  0 siblings, 1 reply; 13+ messages in thread
From: Li Wang @ 2015-01-04  3:10 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list

The regression has a long history, Patch in upstream 2.6.20-rc1
GIT: 39dde65c9940c97fcd178a3d2b1c57ed8b7b68aa. 
https://lkml.org/lkml/2012/4/16/129

Not long before, Fujistu guys request us(RedHat) to cover this regression test in RHEL7-next , then I found two Redhat BZs on clearly tracing this issue:
https://bugzilla.redhat.com/show_bug.cgi?id=428612
https://bugzilla.redhat.com/show_bug.cgi?id=222753#c16
So, I port the testcase to LTP.

-- 
Regards, 
Li Wang 
Email: liwang@redhat.com 



----- Original Message -----
> 
> 
> 
> 
> ----- Original Message -----
> > From: "Li Wang" <liwang@redhat.com>
> > To: ltp-list@lists.sourceforge.net
> > Sent: Saturday, 27 December, 2014 8:13:06 AM
> > Subject: [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak inspection
> > 
> > Description of Problem:
> >     When over 1GB shared memory was alocated in hugepage, the hugepage
> >     is not released though process finished.
> 
> This looks like a regression test for kernel bug. Do you know what
> kernel version are affected and which commit is fixing it?
> 
> Regards,
> Jan
> 
> > 
> > Signed-off-by: Li Wang <liwang@redhat.com>
> > ---
> >  runtest/hugetlb                                    |   1 +
> >  testcases/kernel/mem/.gitignore                    |   1 +
> >  .../kernel/mem/hugetlb/hugeshmat/hugeshmat04.c     | 185
> >  +++++++++++++++++++++
> >  3 files changed, 187 insertions(+)
> >  create mode 100644 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> > 
> > diff --git a/runtest/hugetlb b/runtest/hugetlb
> > index 3eaf14c..805141d 100644
> > --- a/runtest/hugetlb
> > +++ b/runtest/hugetlb
> > @@ -10,6 +10,7 @@ hugemmap05_3 hugemmap05 -s -m
> >  hugeshmat01 hugeshmat01 -i 5
> >  hugeshmat02 hugeshmat02 -i 5
> >  hugeshmat03 hugeshmat03 -i 5
> > +hugeshmat04 hugeshamt04 -i 5
> >  
> >  hugeshmctl01 hugeshmctl01 -i 5
> >  hugeshmctl02 hugeshmctl02 -i 5
> > diff --git a/testcases/kernel/mem/.gitignore
> > b/testcases/kernel/mem/.gitignore
> > index f96964c..c531563 100644
> > --- a/testcases/kernel/mem/.gitignore
> > +++ b/testcases/kernel/mem/.gitignore
> > @@ -6,6 +6,7 @@
> >  /hugetlb/hugeshmat/hugeshmat01
> >  /hugetlb/hugeshmat/hugeshmat02
> >  /hugetlb/hugeshmat/hugeshmat03
> > +/hugetlb/hugeshmat/hugeshmat04
> >  /hugetlb/hugeshmctl/hugeshmctl01
> >  /hugetlb/hugeshmctl/hugeshmctl02
> >  /hugetlb/hugeshmctl/hugeshmctl03
> > diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> > b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> > new file mode 100644
> > index 0000000..515947b
> > --- /dev/null
> > +++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> > @@ -0,0 +1,185 @@
> > +/*
> > + *   Copyright (c) Linux Test Project, 2014
> > + *
> > + *   This program is free software;  you can redistribute it and/or modify
> > + *   it under the terms of the GNU General Public License as published by
> > + *   the Free Software Foundation; either version 2 of the License, or
> > + *   (at your option) any later version.
> > + *
> > + *   This program is distributed in the hope that it will be useful,
> > + *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
> > + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
> > + *   the GNU General Public License for more details.
> > + *
> > + *   You should have received a copy of the GNU General Public License
> > + *   along with this program;  if not, write to the Free Software
> > + *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> > 02110-1301 USA
> > + */
> > +
> > +/*
> > + * NAME
> > + * 	hugeshmat04.c
> > + *
> > + * DESCRIPTION
> > + *	hugeshmat04 - test for hugepage leak inspection.
> > + *
> > + *      Description of Problem:
> > + *          When over 1GB shered memory was alocated in hugepage, the
> > hugepage
> > + *          is not released though process finished.
> > + *
> > + *          You need more than 2GB memory in test job
> > + *
> > + *	Return value:
> > + *	  0: 	 Test successed.  No regression found.
> > + *	  1: 	 Test failed.  Maybe memory shortage.  Please retry testing.
> > + *	  2: 	 Test failed.  Regression detected.
> > + *	  other: Test failed.  Other problem detected.
> > + *
> > + * HISTORY
> > + * 	05/2014 - Written by Fujistu Corp.
> > + *     	12/2014 - Port to LTP by Li Wang.
> > + *
> > + * RESTRICTIONS
> > + * 	test must be run at root
> > + */
> > +
> > +#include <stdio.h>
> > +#include <stdlib.h>
> > +#include <unistd.h>
> > +#include <fcntl.h>
> > +#include <string.h>
> > +#include <sys/mman.h>
> > +#include <sys/types.h>
> > +#include <sys/shm.h>
> > +#include <sys/wait.h>
> > +
> > +#include "test.h"
> > +#include "mem.h"
> > +
> > +#define SIZE	(1024 * 1024 * 1024)
> > +#define BOUNDARY (1024 * 1024 * 1024)
> > +
> > +char *TCID = "hugeshmat04";
> > +int TST_TOTAL = 3;
> > +
> > +static int huge_total;
> > +static int huge_free;
> > +static int huge_free2;
> > +static long hugepages;
> > +static long orig_hugepages;
> > +
> > +static int shared_hugepage(void);
> > +
> > +
> > +int main(int ac, char **av)
> > +{
> > +	int lc, i, ret;
> > +	const char *msg;
> > +
> > +	msg = parse_opts(ac,av, NULL, NULL);
> > +	if (msg != NULL)
> > +		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
> > +
> > +	setup();
> > +
> > +	for (lc = 0; TEST_LOOPING(lc); lc++) {
> > +		tst_count = 0;
> > +
> > +		for (i = 0; i < TST_TOTAL; i++) {
> > +			huge_total = read_meminfo("HugePages_Total:");
> > +			huge_free = read_meminfo("HugePages_Free:");
> > +
> > +			if (huge_total == hugepages && huge_free == hugepages) {
> > +				ret = shared_hugepage();
> > +
> > +				huge_free2 = read_meminfo("HugePages_Free:");
> > +				if (huge_free2 != huge_free)
> > +					ret = 2;
> > +			} else {
> > +				ret = 1;
> > +			}
> > +
> > +			switch (ret) {
> > +			case 0:
> > +				tst_resm(TPASS,
> > +					"No regression found.");
> > +				break;
> > +			case 1:
> > +				tst_brkm(TFAIL, cleanup,
> > +					"Test failed. Maybe memory shortage.");
> > +				break;
> > +			case 2:
> > +				tst_brkm(TFAIL, cleanup,
> > +					"Test failed. Hugepage leak inspection.");
> > +				break;
> > +			default:
> > +				tst_brkm(TFAIL, cleanup,
> > +					"Test failed. Other problem detected.");
> > +				break;
> > +			}
> > +
> > +		}
> > +	}
> > +	cleanup();
> > +	tst_exit();
> > +}
> > +
> > +int shared_hugepage(void)
> > +{
> > +	pid_t pid;
> > +	int status, shmid;
> > +	size_t size = (size_t)SIZE;
> > +	void *buf;
> > +
> > +	shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | 0777);
> > +	if (shmid < 0)
> > +		tst_brkm(TBROK | TERRNO, cleanup, "shmget");
> > +
> > +	buf = shmat(shmid, (void *)BOUNDARY, SHM_RND | 0777);
> > +	if ( buf == (void *)-1 ) {
> > +		shmctl(shmid, IPC_RMID, NULL);
> > +		tst_brkm(TBROK | TERRNO, cleanup, "shmat");
> > +	}
> > +
> > +	memset(buf, 2, size);
> > +	sleep(3);
> > +	pid = fork();
> > +
> > +	if (pid == 0)
> > +	        exit(1);
> > +	else if (pid < 0)
> > +	 	tst_brkm(TBROK | TERRNO, cleanup, "fork");
> > +
> > +	wait(&status);
> > +	shmdt(buf);
> > +	shmctl(shmid, IPC_RMID, NULL);
> > +
> > +	return 0;
> > +}
> > +
> > +void setup(void)
> > +{
> > +	long mem_total, hpage_size;
> > +
> > +	tst_require_root(NULL);
> > +
> > +	mem_total = read_meminfo("MemTotal:");
> > +	if (mem_total < 2097152) {
> > +		tst_resm(TINFO, "Total memory should greater than 2G.");
> > +		tst_exit();
> > +	}
> > +
> > +	orig_hugepages = get_sys_tune("nr_hugepages");
> > +	hpage_size = read_meminfo("Hugepagesize:");
> > +
> > +	hugepages = (orig_hugepages * hpage_size + 1048576) / hpage_size;
> > +	set_sys_tune("nr_hugepages", hugepages, 1);
> > +
> > +	TEST_PAUSE;
> > +}
> > +
> > +void cleanup(void)
> > +{
> > +	TEST_CLEANUP;
> > +	set_sys_tune("nr_hugepages", orig_hugepages, 0);
> > +}
> > --
> > 1.8.3.1
> > 
> > 
> > ------------------------------------------------------------------------------
> > Dive into the World of Parallel Programming! The Go Parallel Website,
> > sponsored by Intel and developed in partnership with Slashdot Media, is
> > your
> > hub for all things parallel software development, from weekly thought
> > leadership blogs to news, videos, case studies, tutorials and more. Take a
> > look and join the conversation now. http://goparallel.sourceforge.net
> > _______________________________________________
> > Ltp-list mailing list
> > Ltp-list@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/ltp-list
> > 
> 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
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] mem/hugeshmat: new case for hugepage leak inspection
  2015-01-04  3:10   ` Li Wang
@ 2015-01-05 10:16     ` Jan Stancek
  2015-01-06  9:51       ` Li Wang
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Stancek @ 2015-01-05 10:16 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp-list





----- Original Message -----
> From: "Li Wang" <liwang@redhat.com>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp-list@lists.sourceforge.net
> Sent: Sunday, 4 January, 2015 4:10:38 AM
> Subject: Re: [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak inspection
> 
> The regression has a long history, Patch in upstream 2.6.20-rc1
> GIT: 39dde65c9940c97fcd178a3d2b1c57ed8b7b68aa.
> https://lkml.org/lkml/2012/4/16/129

And fix is presumably this commit:

ommit c5c99429fa57dcf6e05203ebe3676db1ec646793
Author: Larry Woodman <lwoodman@redhat.com>
Date:   Thu Jan 24 05:49:25 2008 -0800
    fix hugepages leak due to pagetable page sharing

It'd be nice to include this information somewhere in testcase or commit message.
More comments below:

> 
> Not long before, Fujistu guys request us(RedHat) to cover this regression
> test in RHEL7-next , then I found two Redhat BZs on clearly tracing this
> issue:
> https://bugzilla.redhat.com/show_bug.cgi?id=428612
> https://bugzilla.redhat.com/show_bug.cgi?id=222753#c16
> So, I port the testcase to LTP.
> 
> --
> Regards,
> Li Wang
> Email: liwang@redhat.com
> 
> 
> 
> ----- Original Message -----
> > 
> > 
> > 
> > 
> > ----- Original Message -----
> > > From: "Li Wang" <liwang@redhat.com>
> > > To: ltp-list@lists.sourceforge.net
> > > Sent: Saturday, 27 December, 2014 8:13:06 AM
> > > Subject: [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak
> > > inspection
> > > 
> > > Description of Problem:
> > >     When over 1GB shared memory was alocated in hugepage, the hugepage
> > >     is not released though process finished.
> > 
> > This looks like a regression test for kernel bug. Do you know what
> > kernel version are affected and which commit is fixing it?
> > 
> > Regards,
> > Jan
> > 
> > > 
> > > Signed-off-by: Li Wang <liwang@redhat.com>
> > > ---
> > >  runtest/hugetlb                                    |   1 +
> > >  testcases/kernel/mem/.gitignore                    |   1 +
> > >  .../kernel/mem/hugetlb/hugeshmat/hugeshmat04.c     | 185
> > >  +++++++++++++++++++++
> > >  3 files changed, 187 insertions(+)
> > >  create mode 100644 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> > > 
> > > diff --git a/runtest/hugetlb b/runtest/hugetlb
> > > index 3eaf14c..805141d 100644
> > > --- a/runtest/hugetlb
> > > +++ b/runtest/hugetlb
> > > @@ -10,6 +10,7 @@ hugemmap05_3 hugemmap05 -s -m
> > >  hugeshmat01 hugeshmat01 -i 5
> > >  hugeshmat02 hugeshmat02 -i 5
> > >  hugeshmat03 hugeshmat03 -i 5
> > > +hugeshmat04 hugeshamt04 -i 5
> > >  
> > >  hugeshmctl01 hugeshmctl01 -i 5
> > >  hugeshmctl02 hugeshmctl02 -i 5
> > > diff --git a/testcases/kernel/mem/.gitignore
> > > b/testcases/kernel/mem/.gitignore
> > > index f96964c..c531563 100644
> > > --- a/testcases/kernel/mem/.gitignore
> > > +++ b/testcases/kernel/mem/.gitignore
> > > @@ -6,6 +6,7 @@
> > >  /hugetlb/hugeshmat/hugeshmat01
> > >  /hugetlb/hugeshmat/hugeshmat02
> > >  /hugetlb/hugeshmat/hugeshmat03
> > > +/hugetlb/hugeshmat/hugeshmat04
> > >  /hugetlb/hugeshmctl/hugeshmctl01
> > >  /hugetlb/hugeshmctl/hugeshmctl02
> > >  /hugetlb/hugeshmctl/hugeshmctl03
> > > diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> > > b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> > > new file mode 100644
> > > index 0000000..515947b
> > > --- /dev/null
> > > +++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> > > @@ -0,0 +1,185 @@
> > > +/*
> > > + *   Copyright (c) Linux Test Project, 2014
> > > + *
> > > + *   This program is free software;  you can redistribute it and/or
> > > modify
> > > + *   it under the terms of the GNU General Public License as published
> > > by
> > > + *   the Free Software Foundation; either version 2 of the License, or
> > > + *   (at your option) any later version.
> > > + *
> > > + *   This program is distributed in the hope that it will be useful,
> > > + *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
> > > + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
> > > + *   the GNU General Public License for more details.
> > > + *
> > > + *   You should have received a copy of the GNU General Public License
> > > + *   along with this program;  if not, write to the Free Software
> > > + *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> > > 02110-1301 USA
> > > + */
> > > +
> > > +/*
> > > + * NAME
> > > + * 	hugeshmat04.c
> > > + *

I'm getting numerous white errors with git-am. Can you run your patch through checkpatch?

> > > + * DESCRIPTION
> > > + *	hugeshmat04 - test for hugepage leak inspection.
> > > + *
> > > + *      Description of Problem:
> > > + *          When over 1GB shered memory was alocated in hugepage, the
> > > hugepage
> > > + *          is not released though process finished.
> > > + *
> > > + *          You need more than 2GB memory in test job
> > > + *
> > > + *	Return value:
> > > + *	  0: 	 Test successed.  No regression found.
> > > + *	  1: 	 Test failed.  Maybe memory shortage.  Please retry testing.

Can't we test for enough huge pages in setup, so we don't have to guess why it failed?
If we don't have enough huge pages for test, setup() should end with TCONF.

> > > + *	  2: 	 Test failed.  Regression detected.
> > > + *	  other: Test failed.  Other problem detected.

I don't see how you could end up with different value.

> > > + *
> > > + * HISTORY
> > > + * 	05/2014 - Written by Fujistu Corp.
> > > + *     	12/2014 - Port to LTP by Li Wang.
> > > + *
> > > + * RESTRICTIONS
> > > + * 	test must be run at root
> > > + */
> > > +
> > > +#include <stdio.h>
> > > +#include <stdlib.h>
> > > +#include <unistd.h>
> > > +#include <fcntl.h>
> > > +#include <string.h>
> > > +#include <sys/mman.h>
> > > +#include <sys/types.h>
> > > +#include <sys/shm.h>
> > > +#include <sys/wait.h>
> > > +
> > > +#include "test.h"
> > > +#include "mem.h"
> > > +
> > > +#define SIZE	(1024 * 1024 * 1024)
> > > +#define BOUNDARY (1024 * 1024 * 1024)
> > > +
> > > +char *TCID = "hugeshmat04";
> > > +int TST_TOTAL = 3;
> > > +
> > > +static int huge_total;
> > > +static int huge_free;
> > > +static int huge_free2;
> > > +static long hugepages;
> > > +static long orig_hugepages;
> > > +
> > > +static int shared_hugepage(void);
> > > +
> > > +
> > > +int main(int ac, char **av)
> > > +{
> > > +	int lc, i, ret;
> > > +	const char *msg;
> > > +
> > > +	msg = parse_opts(ac,av, NULL, NULL);
> > > +	if (msg != NULL)
> > > +		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
> > > +
> > > +	setup();
> > > +
> > > +	for (lc = 0; TEST_LOOPING(lc); lc++) {
> > > +		tst_count = 0;
> > > +
> > > +		for (i = 0; i < TST_TOTAL; i++) {
> > > +			huge_total = read_meminfo("HugePages_Total:");
> > > +			huge_free = read_meminfo("HugePages_Free:");
> > > +
> > > +			if (huge_total == hugepages && huge_free == hugepages) {

This condition assumes that all huge pages must be free when test starts.
Isn't it enough to test that number of free huge pages before and after test is the same?

> > > +				ret = shared_hugepage();

shared_hugepage() always returns 0

> > > +
> > > +				huge_free2 = read_meminfo("HugePages_Free:");
> > > +				if (huge_free2 != huge_free)
> > > +					ret = 2;
> > > +			} else {
> > > +				ret = 1;
> > > +			}
> > > +

switch below seems unnecessary if you remove "ret" and put tst_resm/brkm at places
where you initialize "ret".

> > > +			switch (ret) {
> > > +			case 0:
> > > +				tst_resm(TPASS,
> > > +					"No regression found.");
> > > +				break;
> > > +			case 1:
> > > +				tst_brkm(TFAIL, cleanup,
> > > +					"Test failed. Maybe memory shortage.");
> > > +				break;
> > > +			case 2:
> > > +				tst_brkm(TFAIL, cleanup,
> > > +					"Test failed. Hugepage leak inspection.");
> > > +				break;
> > > +			default:
> > > +				tst_brkm(TFAIL, cleanup,
> > > +					"Test failed. Other problem detected.");
> > > +				break;
> > > +			}
> > > +
> > > +		}
> > > +	}
> > > +	cleanup();
> > > +	tst_exit();
> > > +}
> > > +
> > > +int shared_hugepage(void)
> > > +{
> > > +	pid_t pid;
> > > +	int status, shmid;
> > > +	size_t size = (size_t)SIZE;
> > > +	void *buf;
> > > +
> > > +	shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | 0777);
> > > +	if (shmid < 0)
> > > +		tst_brkm(TBROK | TERRNO, cleanup, "shmget");
> > > +
> > > +	buf = shmat(shmid, (void *)BOUNDARY, SHM_RND | 0777);

Does it make a difference where you attach shared segment? I'm slightly worried,
that absolute address you picked may already be in use on some distros/arches.

> > > +	if ( buf == (void *)-1 ) {
> > > +		shmctl(shmid, IPC_RMID, NULL);
> > > +		tst_brkm(TBROK | TERRNO, cleanup, "shmat");
> > > +	}
> > > +
> > > +	memset(buf, 2, size);
> > > +	sleep(3);

What is this sleep for?

> > > +	pid = fork();
> > > +
> > > +	if (pid == 0)
> > > +	        exit(1);
> > > +	else if (pid < 0)
> > > +	 	tst_brkm(TBROK | TERRNO, cleanup, "fork");
> > > +
> > > +	wait(&status);
> > > +	shmdt(buf);
> > > +	shmctl(shmid, IPC_RMID, NULL);
> > > +
> > > +	return 0;

The return value seems pointless as it always returns 0.

> > > +}
> > > +
> > > +void setup(void)
> > > +{
> > > +	long mem_total, hpage_size;
> > > +
> > > +	tst_require_root(NULL);
> > > +
> > > +	mem_total = read_meminfo("MemTotal:");
> > > +	if (mem_total < 2097152) {
> > > +		tst_resm(TINFO, "Total memory should greater than 2G.");
> > > +		tst_exit();
> > > +	}
> > > +
> > > +	orig_hugepages = get_sys_tune("nr_hugepages");
> > > +	hpage_size = read_meminfo("Hugepagesize:");
> > > +
> > > +	hugepages = (orig_hugepages * hpage_size + 1048576) / hpage_size;

Can you use already defined "SIZE" instead of hardcoding values above?
Also if there are not enough huge pages for test, it should end with TCONF.

Regards,
Jan

> > > +	set_sys_tune("nr_hugepages", hugepages, 1);
> > > +
> > > +	TEST_PAUSE;
> > > +}
> > > +
> > > +void cleanup(void)
> > > +{
> > > +	TEST_CLEANUP;
> > > +	set_sys_tune("nr_hugepages", orig_hugepages, 0);
> > > +}
> > > --
> > > 1.8.3.1
> > > 
> > > 
> > > ------------------------------------------------------------------------------
> > > Dive into the World of Parallel Programming! The Go Parallel Website,
> > > sponsored by Intel and developed in partnership with Slashdot Media, is
> > > your
> > > hub for all things parallel software development, from weekly thought
> > > leadership blogs to news, videos, case studies, tutorials and more. Take
> > > a
> > > look and join the conversation now. http://goparallel.sourceforge.net
> > > _______________________________________________
> > > Ltp-list mailing list
> > > Ltp-list@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/ltp-list
> > > 
> > 
> 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
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] mem/hugeshmat: new case for hugepage leak inspection
  2015-01-05 10:16     ` Jan Stancek
@ 2015-01-06  9:51       ` Li Wang
  2015-01-06 10:35         ` Jan Stancek
  0 siblings, 1 reply; 13+ messages in thread
From: Li Wang @ 2015-01-06  9:51 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list


> ----- Original Message -----
> > From: "Li Wang" <liwang@redhat.com>
> > To: "Jan Stancek" <jstancek@redhat.com>
> > Cc: ltp-list@lists.sourceforge.net
> > Sent: Sunday, 4 January, 2015 4:10:38 AM
> > Subject: Re: [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak
> > inspection
> > 
> > The regression has a long history, Patch in upstream 2.6.20-rc1
> > GIT: 39dde65c9940c97fcd178a3d2b1c57ed8b7b68aa.
> > https://lkml.org/lkml/2012/4/16/129
> 
> And fix is presumably this commit:
> 
> ommit c5c99429fa57dcf6e05203ebe3676db1ec646793
> Author: Larry Woodman <lwoodman@redhat.com>
> Date:   Thu Jan 24 05:49:25 2008 -0800
>     fix hugepages leak due to pagetable page sharing
> 
> It'd be nice to include this information somewhere in testcase or commit
> message.
> More comments below:
...
> > > > +int shared_hugepage(void)
> > > > +{
> > > > +	pid_t pid;
> > > > +	int status, shmid;
> > > > +	size_t size = (size_t)SIZE;
> > > > +	void *buf;
> > > > +
> > > > +	shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | 0777);
> > > > +	if (shmid < 0)
> > > > +		tst_brkm(TBROK | TERRNO, cleanup, "shmget");
> > > > +
> > > > +	buf = shmat(shmid, (void *)BOUNDARY, SHM_RND | 0777);
> 
> Does it make a difference where you attach shared segment? I'm slightly
> worried,
> that absolute address you picked may already be in use on some
> distros/arches.

Hi Jan,

Thank you for reviewing my stupid patch. :)

Actually I also don't know why using absolute address here, I doubt this 
manner are similar with the BZ occurred environment. The sleep(3) below as well.

Since the original case is too old to found out who is the author. I hope someone 
now could provide any useful discussion here, if not, I still feel we can use these 
code to cover the regression. What do you think?


A new patch:

Subject: [PATCH] mem/hugeshmat: new case for hugepage leak inspection

Description of Problem:
	When over 1GB shared memory was alocated in hugepage, the hugepage
	is not released though process finished.

The fix is this commit:
	commit c5c99429fa57dcf6e05203ebe3676db1ec646793
	Author: Larry Woodman <lwoodman@redhat.com>
	Date:   Thu Jan 24 05:49:25 2008 -0800
    	fix hugepages leak due to pagetable page sharing

Signed-off-by: Li Wang <liwang@redhat.com>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 runtest/hugetlb                                    |   1 +
 testcases/kernel/mem/.gitignore                    |   1 +
 .../kernel/mem/hugetlb/hugeshmat/hugeshmat04.c     | 166 +++++++++++++++++++++
 3 files changed, 168 insertions(+)
 create mode 100644 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c

diff --git a/runtest/hugetlb b/runtest/hugetlb
index 3eaf14c..805141d 100644
--- a/runtest/hugetlb
+++ b/runtest/hugetlb
@@ -10,6 +10,7 @@ hugemmap05_3 hugemmap05 -s -m
 hugeshmat01 hugeshmat01 -i 5
 hugeshmat02 hugeshmat02 -i 5
 hugeshmat03 hugeshmat03 -i 5
+hugeshmat04 hugeshamt04 -i 5
 
 hugeshmctl01 hugeshmctl01 -i 5
 hugeshmctl02 hugeshmctl02 -i 5
diff --git a/testcases/kernel/mem/.gitignore b/testcases/kernel/mem/.gitignore
index f96964c..c531563 100644
--- a/testcases/kernel/mem/.gitignore
+++ b/testcases/kernel/mem/.gitignore
@@ -6,6 +6,7 @@
 /hugetlb/hugeshmat/hugeshmat01
 /hugetlb/hugeshmat/hugeshmat02
 /hugetlb/hugeshmat/hugeshmat03
+/hugetlb/hugeshmat/hugeshmat04
 /hugetlb/hugeshmctl/hugeshmctl01
 /hugetlb/hugeshmctl/hugeshmctl02
 /hugetlb/hugeshmctl/hugeshmctl03
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
new file mode 100644
index 0000000..43e9f3f
--- /dev/null
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
@@ -0,0 +1,166 @@
+/*
+ *   Copyright (c) Linux Test Project, 2014
+ *
+ *   This program is free software;  you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ *   the GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program;  if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ *   02110-1301 USA
+ */
+
+/*
+ * NAME
+ * 	hugeshmat04.c
+ *
+ * DESCRIPTION
+ *	hugeshmat04 - test for hugepage leak inspection.
+ *
+ *      Description of Problem:
+ *         When over 1GB shered memory was alocated in hugepage, the hugepage
+ *         is not released though process finished.
+ *
+ *         You need more than 2GB memory in test job
+ *
+ *	Test results:
+ *	   Successed: No regression found.
+ *	   Failed:    Regression detected.
+ *
+ * HISTORY
+ * 	05/2014 - Written by Fujistu Corp.
+ *	12/2014 - Port to LTP by Li Wang.
+ *
+ * RESTRICTIONS
+ * 	test must be run at root
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/shm.h>
+#include <sys/wait.h>
+
+#include "test.h"
+#include "mem.h"
+
+#define SIZE	(1024 * 1024 * 1024)
+#define BOUNDARY (1024 * 1024 * 1024)
+
+char *TCID = "hugeshmat04";
+int TST_TOTAL = 3;
+
+static long huge_total;
+static long huge_free;
+static long huge_free2;
+static long hugepages;
+static long orig_hugepages;
+
+static void shared_hugepage(void);
+
+int main(int ac, char **av)
+{
+	int lc, i;
+	const char *msg;
+
+	msg = parse_opts(ac, av, NULL, NULL);
+	if (msg != NULL)
+		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+
+	setup();
+
+	for (lc = 0; TEST_LOOPING(lc); lc++) {
+		tst_count = 0;
+
+		for (i = 0; i < TST_TOTAL; i++) {
+
+			shared_hugepage();
+			huge_free2 = read_meminfo("HugePages_Free:");
+
+			if (huge_free2 != huge_free)
+				tst_brkm(TFAIL, cleanup,
+					"Test failed. Hugepage leak inspection.");
+			else
+				tst_resm(TPASS, "No regression found.");
+		}
+	}
+
+	cleanup();
+	tst_exit();
+}
+
+void shared_hugepage(void)
+{
+	pid_t pid;
+	int status, shmid;
+	size_t size = (size_t)SIZE;
+	void *buf;
+
+	shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | 0777);
+	if (shmid < 0)
+		tst_brkm(TBROK | TERRNO, cleanup, "shmget");
+
+	buf = shmat(shmid, (void *)BOUNDARY, SHM_RND | 0777);
+	if (buf == (void *)-1) {
+		shmctl(shmid, IPC_RMID, NULL);
+		tst_brkm(TBROK | TERRNO, cleanup, "shmat");
+	}
+
+	memset(buf, 2, size);
+	sleep(3);
+	pid = fork();
+
+	if (pid == 0)
+		exit(1);
+	else if (pid < 0)
+		tst_brkm(TBROK | TERRNO, cleanup, "fork");
+
+	wait(&status);
+	shmdt(buf);
+	shmctl(shmid, IPC_RMID, NULL);
+}
+
+void setup(void)
+{
+	long mem_total, hpage_size;
+
+	tst_require_root(NULL);
+
+	mem_total = read_meminfo("MemTotal:") * 1024;
+	if (mem_total < 2L*SIZE) {
+		tst_resm(TINFO, "Total memory should greater than 2G.");
+		tst_exit();
+	}
+
+	orig_hugepages = get_sys_tune("nr_hugepages");
+	hpage_size = read_meminfo("Hugepagesize:") * 1024;
+
+	hugepages = (orig_hugepages * hpage_size + SIZE) / hpage_size;
+	set_sys_tune("nr_hugepages", hugepages, 1);
+
+	huge_total = read_meminfo("HugePages_Total:");
+	huge_free = read_meminfo("HugePages_Free:");
+
+	if (huge_total != hugepages || huge_free != hugepages)
+		tst_brkm(TCONF, cleanup,
+			"Maybe huge pages not enough for test.");
+
+	TEST_PAUSE;
+}
+
+void cleanup(void)
+{
+	TEST_CLEANUP;
+	set_sys_tune("nr_hugepages", orig_hugepages, 0);
+}
-- 
1.8.3.1

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
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] mem/hugeshmat: new case for hugepage leak inspection
  2015-01-06  9:51       ` Li Wang
@ 2015-01-06 10:35         ` Jan Stancek
  2015-01-06 14:07           ` Li Wang
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Stancek @ 2015-01-06 10:35 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp-list





----- Original Message -----
> From: "Li Wang" <liwang@redhat.com>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp-list@lists.sourceforge.net
> Sent: Tuesday, 6 January, 2015 10:51:52 AM
> Subject: Re: [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak inspection
> 
> 
> > ----- Original Message -----
> > > From: "Li Wang" <liwang@redhat.com>
> > > To: "Jan Stancek" <jstancek@redhat.com>
> > > Cc: ltp-list@lists.sourceforge.net
> > > Sent: Sunday, 4 January, 2015 4:10:38 AM
> > > Subject: Re: [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak
> > > inspection
> > > 
> > > The regression has a long history, Patch in upstream 2.6.20-rc1
> > > GIT: 39dde65c9940c97fcd178a3d2b1c57ed8b7b68aa.
> > > https://lkml.org/lkml/2012/4/16/129
> > 
> > And fix is presumably this commit:
> > 
> > ommit c5c99429fa57dcf6e05203ebe3676db1ec646793
> > Author: Larry Woodman <lwoodman@redhat.com>
> > Date:   Thu Jan 24 05:49:25 2008 -0800
> >     fix hugepages leak due to pagetable page sharing
> > 
> > It'd be nice to include this information somewhere in testcase or commit
> > message.
> > More comments below:
> ...
> > > > > +int shared_hugepage(void)
> > > > > +{
> > > > > +	pid_t pid;
> > > > > +	int status, shmid;
> > > > > +	size_t size = (size_t)SIZE;
> > > > > +	void *buf;
> > > > > +
> > > > > +	shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | 0777);
> > > > > +	if (shmid < 0)
> > > > > +		tst_brkm(TBROK | TERRNO, cleanup, "shmget");
> > > > > +
> > > > > +	buf = shmat(shmid, (void *)BOUNDARY, SHM_RND | 0777);
> > 
> > Does it make a difference where you attach shared segment? I'm slightly
> > worried,
> > that absolute address you picked may already be in use on some
> > distros/arches.
> 
> Hi Jan,
> 
> Thank you for reviewing my stupid patch. :)
> 
> Actually I also don't know why using absolute address here, I doubt this
> manner are similar with the BZ occurred environment. The sleep(3) below as
> well.
> 
> Since the original case is too old to found out who is the author. I hope
> someone
> now could provide any useful discussion here, if not, I still feel we can use
> these
> code to cover the regression. What do you think?

I'm assuming that both absolute address and sleep is not necessary.
I think I'll take some recent kernel, revert that patch and try to reproduce
the failure.

Regards,
Jan

> 
> 
> A new patch:
> 
> Subject: [PATCH] mem/hugeshmat: new case for hugepage leak inspection
> 
> Description of Problem:
> 	When over 1GB shared memory was alocated in hugepage, the hugepage
> 	is not released though process finished.
> 
> The fix is this commit:
> 	commit c5c99429fa57dcf6e05203ebe3676db1ec646793
> 	Author: Larry Woodman <lwoodman@redhat.com>
> 	Date:   Thu Jan 24 05:49:25 2008 -0800
>     	fix hugepages leak due to pagetable page sharing
> 
> Signed-off-by: Li Wang <liwang@redhat.com>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
>  runtest/hugetlb                                    |   1 +
>  testcases/kernel/mem/.gitignore                    |   1 +
>  .../kernel/mem/hugetlb/hugeshmat/hugeshmat04.c     | 166
>  +++++++++++++++++++++
>  3 files changed, 168 insertions(+)
>  create mode 100644 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> 
> diff --git a/runtest/hugetlb b/runtest/hugetlb
> index 3eaf14c..805141d 100644
> --- a/runtest/hugetlb
> +++ b/runtest/hugetlb
> @@ -10,6 +10,7 @@ hugemmap05_3 hugemmap05 -s -m
>  hugeshmat01 hugeshmat01 -i 5
>  hugeshmat02 hugeshmat02 -i 5
>  hugeshmat03 hugeshmat03 -i 5
> +hugeshmat04 hugeshamt04 -i 5
>  
>  hugeshmctl01 hugeshmctl01 -i 5
>  hugeshmctl02 hugeshmctl02 -i 5
> diff --git a/testcases/kernel/mem/.gitignore
> b/testcases/kernel/mem/.gitignore
> index f96964c..c531563 100644
> --- a/testcases/kernel/mem/.gitignore
> +++ b/testcases/kernel/mem/.gitignore
> @@ -6,6 +6,7 @@
>  /hugetlb/hugeshmat/hugeshmat01
>  /hugetlb/hugeshmat/hugeshmat02
>  /hugetlb/hugeshmat/hugeshmat03
> +/hugetlb/hugeshmat/hugeshmat04
>  /hugetlb/hugeshmctl/hugeshmctl01
>  /hugetlb/hugeshmctl/hugeshmctl02
>  /hugetlb/hugeshmctl/hugeshmctl03
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> new file mode 100644
> index 0000000..43e9f3f
> --- /dev/null
> +++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> @@ -0,0 +1,166 @@
> +/*
> + *   Copyright (c) Linux Test Project, 2014
> + *
> + *   This program is free software;  you can redistribute it and/or modify
> + *   it under the terms of the GNU General Public License as published by
> + *   the Free Software Foundation; either version 2 of the License, or
> + *   (at your option) any later version.
> + *
> + *   This program is distributed in the hope that it will be useful,
> + *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
> + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
> + *   the GNU General Public License for more details.
> + *
> + *   You should have received a copy of the GNU General Public License
> + *   along with this program;  if not, write to the Free Software
> + *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> + *   02110-1301 USA
> + */
> +
> +/*
> + * NAME
> + * 	hugeshmat04.c
> + *
> + * DESCRIPTION
> + *	hugeshmat04 - test for hugepage leak inspection.
> + *
> + *      Description of Problem:
> + *         When over 1GB shered memory was alocated in hugepage, the
> hugepage
> + *         is not released though process finished.
> + *
> + *         You need more than 2GB memory in test job
> + *
> + *	Test results:
> + *	   Successed: No regression found.
> + *	   Failed:    Regression detected.
> + *
> + * HISTORY
> + * 	05/2014 - Written by Fujistu Corp.
> + *	12/2014 - Port to LTP by Li Wang.
> + *
> + * RESTRICTIONS
> + * 	test must be run at root
> + */
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <unistd.h>
> +#include <fcntl.h>
> +#include <string.h>
> +#include <sys/mman.h>
> +#include <sys/types.h>
> +#include <sys/shm.h>
> +#include <sys/wait.h>
> +
> +#include "test.h"
> +#include "mem.h"
> +
> +#define SIZE	(1024 * 1024 * 1024)
> +#define BOUNDARY (1024 * 1024 * 1024)
> +
> +char *TCID = "hugeshmat04";
> +int TST_TOTAL = 3;
> +
> +static long huge_total;
> +static long huge_free;
> +static long huge_free2;
> +static long hugepages;
> +static long orig_hugepages;
> +
> +static void shared_hugepage(void);
> +
> +int main(int ac, char **av)
> +{
> +	int lc, i;
> +	const char *msg;
> +
> +	msg = parse_opts(ac, av, NULL, NULL);
> +	if (msg != NULL)
> +		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
> +
> +	setup();
> +
> +	for (lc = 0; TEST_LOOPING(lc); lc++) {
> +		tst_count = 0;
> +
> +		for (i = 0; i < TST_TOTAL; i++) {
> +
> +			shared_hugepage();
> +			huge_free2 = read_meminfo("HugePages_Free:");
> +
> +			if (huge_free2 != huge_free)
> +				tst_brkm(TFAIL, cleanup,
> +					"Test failed. Hugepage leak inspection.");
> +			else
> +				tst_resm(TPASS, "No regression found.");
> +		}
> +	}
> +
> +	cleanup();
> +	tst_exit();
> +}
> +
> +void shared_hugepage(void)
> +{
> +	pid_t pid;
> +	int status, shmid;
> +	size_t size = (size_t)SIZE;
> +	void *buf;
> +
> +	shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | 0777);
> +	if (shmid < 0)
> +		tst_brkm(TBROK | TERRNO, cleanup, "shmget");
> +
> +	buf = shmat(shmid, (void *)BOUNDARY, SHM_RND | 0777);
> +	if (buf == (void *)-1) {
> +		shmctl(shmid, IPC_RMID, NULL);
> +		tst_brkm(TBROK | TERRNO, cleanup, "shmat");
> +	}
> +
> +	memset(buf, 2, size);
> +	sleep(3);
> +	pid = fork();
> +
> +	if (pid == 0)
> +		exit(1);
> +	else if (pid < 0)
> +		tst_brkm(TBROK | TERRNO, cleanup, "fork");
> +
> +	wait(&status);
> +	shmdt(buf);
> +	shmctl(shmid, IPC_RMID, NULL);
> +}
> +
> +void setup(void)
> +{
> +	long mem_total, hpage_size;
> +
> +	tst_require_root(NULL);
> +
> +	mem_total = read_meminfo("MemTotal:") * 1024;
> +	if (mem_total < 2L*SIZE) {
> +		tst_resm(TINFO, "Total memory should greater than 2G.");
> +		tst_exit();
> +	}
> +
> +	orig_hugepages = get_sys_tune("nr_hugepages");
> +	hpage_size = read_meminfo("Hugepagesize:") * 1024;
> +
> +	hugepages = (orig_hugepages * hpage_size + SIZE) / hpage_size;
> +	set_sys_tune("nr_hugepages", hugepages, 1);
> +
> +	huge_total = read_meminfo("HugePages_Total:");
> +	huge_free = read_meminfo("HugePages_Free:");
> +
> +	if (huge_total != hugepages || huge_free != hugepages)
> +		tst_brkm(TCONF, cleanup,
> +			"Maybe huge pages not enough for test.");
> +
> +	TEST_PAUSE;
> +}
> +
> +void cleanup(void)
> +{
> +	TEST_CLEANUP;
> +	set_sys_tune("nr_hugepages", orig_hugepages, 0);
> +}
> --
> 1.8.3.1
> 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
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] mem/hugeshmat: new case for hugepage leak inspection
  2015-01-06 10:35         ` Jan Stancek
@ 2015-01-06 14:07           ` Li Wang
  2015-01-07 12:32             ` Jan Stancek
  0 siblings, 1 reply; 13+ messages in thread
From: Li Wang @ 2015-01-06 14:07 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list


> ----- Original Message -----
> > From: "Li Wang" <liwang@redhat.com>
> > To: "Jan Stancek" <jstancek@redhat.com>
> > Cc: ltp-list@lists.sourceforge.net
> > Sent: Tuesday, 6 January, 2015 10:51:52 AM
> > Subject: Re: [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak
> > inspection
> > 
> > 
> > > ----- Original Message -----
> > > > From: "Li Wang" <liwang@redhat.com>
> > > > To: "Jan Stancek" <jstancek@redhat.com>
> > > > Cc: ltp-list@lists.sourceforge.net
> > > > Sent: Sunday, 4 January, 2015 4:10:38 AM
> > > > Subject: Re: [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak
> > > > inspection
> > > > 
> > > > The regression has a long history, Patch in upstream 2.6.20-rc1
> > > > GIT: 39dde65c9940c97fcd178a3d2b1c57ed8b7b68aa.
> > > > https://lkml.org/lkml/2012/4/16/129
> > > 
> > > And fix is presumably this commit:
> > > 
> > > ommit c5c99429fa57dcf6e05203ebe3676db1ec646793
> > > Author: Larry Woodman <lwoodman@redhat.com>
> > > Date:   Thu Jan 24 05:49:25 2008 -0800
> > >     fix hugepages leak due to pagetable page sharing
> > > 
> > > It'd be nice to include this information somewhere in testcase or commit
> > > message.
> > > More comments below:
> > ...
> > > > > > +int shared_hugepage(void)
> > > > > > +{
> > > > > > +	pid_t pid;
> > > > > > +	int status, shmid;
> > > > > > +	size_t size = (size_t)SIZE;
> > > > > > +	void *buf;
> > > > > > +
> > > > > > +	shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT |
> > > > > > 0777);
> > > > > > +	if (shmid < 0)
> > > > > > +		tst_brkm(TBROK | TERRNO, cleanup, "shmget");
> > > > > > +
> > > > > > +	buf = shmat(shmid, (void *)BOUNDARY, SHM_RND | 0777);
> > > 
> > > Does it make a difference where you attach shared segment? I'm slightly
> > > worried,
> > > that absolute address you picked may already be in use on some
> > > distros/arches.
> > 
> > Hi Jan,
> > 
> > Thank you for reviewing my stupid patch. :)
> > 
> > Actually I also don't know why using absolute address here, I doubt this
> > manner are similar with the BZ occurred environment. The sleep(3) below as
> > well.
> > 
> > Since the original case is too old to found out who is the author. I hope
> > someone
> > now could provide any useful discussion here, if not, I still feel we can
> > use
> > these
> > code to cover the regression. What do you think?
> 
> I'm assuming that both absolute address and sleep is not necessary.
> I think I'll take some recent kernel, revert that patch and try to reproduce
> the failure.

Hi Jan,

I just tried kernel-3.10.0+ without the fixed patch, and I hit a CPU stuck issue
with absolute address and sleep(3).

Then I tried the testcase with absolute address but not sleep(3), the same results as below.

-------------------------------------
[ 1105.650122] BUG: soft lockup - CPU#3 stuck for 22s! [hugeshmat04:2374]
[ 1105.656649] Modules linked in: intel_powerclamp coretemp kvm_intel kvm crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper pcspkr cryptd serio_raw iTCO_wdt iTCO_vendor_support ppdev lpc_ich mfd_core i2c_i801 ipmi_si parport_pc parport ipmi_msghandler shpchp acpi_cpufreq ioatdma i7core_edac edac_core dca xfs libcrc32c sd_mod sr_mod cdrom crc_t10dif crct10dif_common ast syscopyarea sysfillrect sysimgblt i2c_algo_bit drm_kms_helper ttm ata_generic pata_acpi drm e1000e ata_piix libata ptp i2c_core pps_core dm_mirror dm_region_hash dm_log dm_mod
[ 1105.710690] CPU: 3 PID: 2374 Comm: hugeshmat04 Not tainted 3.10.0+ #1
[ 1105.717124] Hardware name: Lenovo 401118U/Tyan Tank GT20-B7002LNV, BIOS 'V2.7  04.07.2011 ' 04/07/2011
[ 1105.726420] task: ffff88022cc8cfa0 ti: ffff880034e5c000 task.ti: ffff880034e5c000
[ 1105.733894] RIP: 0010:[<ffffffff8160c6b2>]  [<ffffffff8160c6b2>] _raw_spin_lock+0x32/0x50
[ 1105.742081] RSP: 0018:ffff880034e5fc88  EFLAGS: 00000202
[ 1105.747388] RAX: 0000000000005897 RBX: ffff8800342392c0 RCX: 0000000000000402
[ 1105.754515] RDX: 0000000000000404 RSI: 0000000000000404 RDI: ffffea0000d24170
[ 1105.761643] RBP: ffff880034e5fc88 R08: ffff880000000000 R09: ffff880035978fc0
[ 1105.768771] R10: ffff88023ffd7800 R11: 0000000000000000 R12: ffff880034b66030
[ 1105.775898] R13: ffff880034dd3030 R14: 000000002cc8cfa0 R15: 0000000000000000
[ 1105.783026] FS:  00007f3291241740(0000) GS:ffff880237260000(0000) knlGS:0000000000000000
[ 1105.791110] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 1105.796848] CR2: 00007f3290d294c0 CR3: 00000000350a6000 CR4: 00000000000007e0
[ 1105.803977] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 1105.811105] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[ 1105.818233] Stack:
[ 1105.820244]  ffff880034e5fd18 ffffffff8119cf10 0000000080000000 0000000040000000
[ 1105.827702]  ffff880034dd3030 0000000034d25bc8 ffff8800342386b4 ffff880034239334
[ 1105.835160]  ffff8800bac6eaf8 ffff8800342392c0 ffff880034905000 ffff880034238640
[ 1105.842616] Call Trace:
[ 1105.845065]  [<ffffffff8119cf10>] copy_hugetlb_page_range+0xc0/0x300
[ 1105.851421]  [<ffffffff81181d39>] copy_page_range+0x3d9/0x480
[ 1105.857161]  [<ffffffff81186da8>] ? __vma_link_rb+0xb8/0xe0
[ 1105.862728]  [<ffffffff8106ba77>] dup_mm+0x357/0x660
[ 1105.867689]  [<ffffffff8106c7f9>] copy_process.part.25+0xa49/0x14d0
[ 1105.873948]  [<ffffffff8106d43c>] do_fork+0xbc/0x350
[ 1105.878910]  [<ffffffff8106d756>] SyS_clone+0x16/0x20
[ 1105.883964]  [<ffffffff81615679>] stub_clone+0x69/0x90
[ 1105.889098]  [<ffffffff81615329>] ? system_call_fastpath+0x16/0x1b



At last I tried the testcase without absolute address and sleep(3), the test awalys PASS.


From above result, it couldn't tell the whole story, perhaps we should better testing on the kernel less than 2.6.24 version.

Thanks,
Li Wang

> 
> Regards,
> Jan
> 
> > 
> > 
> > A new patch:
> > 
> > Subject: [PATCH] mem/hugeshmat: new case for hugepage leak inspection
> > 
> > Description of Problem:
> > 	When over 1GB shared memory was alocated in hugepage, the hugepage
> > 	is not released though process finished.
> > 
> > The fix is this commit:
> > 	commit c5c99429fa57dcf6e05203ebe3676db1ec646793
> > 	Author: Larry Woodman <lwoodman@redhat.com>
> > 	Date:   Thu Jan 24 05:49:25 2008 -0800
> >     	fix hugepages leak due to pagetable page sharing
> > 
> > Signed-off-by: Li Wang <liwang@redhat.com>
> > Signed-off-by: Jan Stancek <jstancek@redhat.com>
> > ---
> >  runtest/hugetlb                                    |   1 +
> >  testcases/kernel/mem/.gitignore                    |   1 +
> >  .../kernel/mem/hugetlb/hugeshmat/hugeshmat04.c     | 166
> >  +++++++++++++++++++++
> >  3 files changed, 168 insertions(+)
> >  create mode 100644 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> > 
> > diff --git a/runtest/hugetlb b/runtest/hugetlb
> > index 3eaf14c..805141d 100644
> > --- a/runtest/hugetlb
> > +++ b/runtest/hugetlb
> > @@ -10,6 +10,7 @@ hugemmap05_3 hugemmap05 -s -m
> >  hugeshmat01 hugeshmat01 -i 5
> >  hugeshmat02 hugeshmat02 -i 5
> >  hugeshmat03 hugeshmat03 -i 5
> > +hugeshmat04 hugeshamt04 -i 5
> >  
> >  hugeshmctl01 hugeshmctl01 -i 5
> >  hugeshmctl02 hugeshmctl02 -i 5
> > diff --git a/testcases/kernel/mem/.gitignore
> > b/testcases/kernel/mem/.gitignore
> > index f96964c..c531563 100644
> > --- a/testcases/kernel/mem/.gitignore
> > +++ b/testcases/kernel/mem/.gitignore
> > @@ -6,6 +6,7 @@
> >  /hugetlb/hugeshmat/hugeshmat01
> >  /hugetlb/hugeshmat/hugeshmat02
> >  /hugetlb/hugeshmat/hugeshmat03
> > +/hugetlb/hugeshmat/hugeshmat04
> >  /hugetlb/hugeshmctl/hugeshmctl01
> >  /hugetlb/hugeshmctl/hugeshmctl02
> >  /hugetlb/hugeshmctl/hugeshmctl03
> > diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> > b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> > new file mode 100644
> > index 0000000..43e9f3f
> > --- /dev/null
> > +++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> > @@ -0,0 +1,166 @@
> > +/*
> > + *   Copyright (c) Linux Test Project, 2014
> > + *
> > + *   This program is free software;  you can redistribute it and/or modify
> > + *   it under the terms of the GNU General Public License as published by
> > + *   the Free Software Foundation; either version 2 of the License, or
> > + *   (at your option) any later version.
> > + *
> > + *   This program is distributed in the hope that it will be useful,
> > + *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
> > + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
> > + *   the GNU General Public License for more details.
> > + *
> > + *   You should have received a copy of the GNU General Public License
> > + *   along with this program;  if not, write to the Free Software
> > + *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> > + *   02110-1301 USA
> > + */
> > +
> > +/*
> > + * NAME
> > + * 	hugeshmat04.c
> > + *
> > + * DESCRIPTION
> > + *	hugeshmat04 - test for hugepage leak inspection.
> > + *
> > + *      Description of Problem:
> > + *         When over 1GB shered memory was alocated in hugepage, the
> > hugepage
> > + *         is not released though process finished.
> > + *
> > + *         You need more than 2GB memory in test job
> > + *
> > + *	Test results:
> > + *	   Successed: No regression found.
> > + *	   Failed:    Regression detected.
> > + *
> > + * HISTORY
> > + * 	05/2014 - Written by Fujistu Corp.
> > + *	12/2014 - Port to LTP by Li Wang.
> > + *
> > + * RESTRICTIONS
> > + * 	test must be run at root
> > + */
> > +
> > +#include <stdio.h>
> > +#include <stdlib.h>
> > +#include <unistd.h>
> > +#include <fcntl.h>
> > +#include <string.h>
> > +#include <sys/mman.h>
> > +#include <sys/types.h>
> > +#include <sys/shm.h>
> > +#include <sys/wait.h>
> > +
> > +#include "test.h"
> > +#include "mem.h"
> > +
> > +#define SIZE	(1024 * 1024 * 1024)
> > +#define BOUNDARY (1024 * 1024 * 1024)
> > +
> > +char *TCID = "hugeshmat04";
> > +int TST_TOTAL = 3;
> > +
> > +static long huge_total;
> > +static long huge_free;
> > +static long huge_free2;
> > +static long hugepages;
> > +static long orig_hugepages;
> > +
> > +static void shared_hugepage(void);
> > +
> > +int main(int ac, char **av)
> > +{
> > +	int lc, i;
> > +	const char *msg;
> > +
> > +	msg = parse_opts(ac, av, NULL, NULL);
> > +	if (msg != NULL)
> > +		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
> > +
> > +	setup();
> > +
> > +	for (lc = 0; TEST_LOOPING(lc); lc++) {
> > +		tst_count = 0;
> > +
> > +		for (i = 0; i < TST_TOTAL; i++) {
> > +
> > +			shared_hugepage();
> > +			huge_free2 = read_meminfo("HugePages_Free:");
> > +
> > +			if (huge_free2 != huge_free)
> > +				tst_brkm(TFAIL, cleanup,
> > +					"Test failed. Hugepage leak inspection.");
> > +			else
> > +				tst_resm(TPASS, "No regression found.");
> > +		}
> > +	}
> > +
> > +	cleanup();
> > +	tst_exit();
> > +}
> > +
> > +void shared_hugepage(void)
> > +{
> > +	pid_t pid;
> > +	int status, shmid;
> > +	size_t size = (size_t)SIZE;
> > +	void *buf;
> > +
> > +	shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | 0777);
> > +	if (shmid < 0)
> > +		tst_brkm(TBROK | TERRNO, cleanup, "shmget");
> > +
> > +	buf = shmat(shmid, (void *)BOUNDARY, SHM_RND | 0777);
> > +	if (buf == (void *)-1) {
> > +		shmctl(shmid, IPC_RMID, NULL);
> > +		tst_brkm(TBROK | TERRNO, cleanup, "shmat");
> > +	}
> > +
> > +	memset(buf, 2, size);
> > +	sleep(3);
> > +	pid = fork();
> > +
> > +	if (pid == 0)
> > +		exit(1);
> > +	else if (pid < 0)
> > +		tst_brkm(TBROK | TERRNO, cleanup, "fork");
> > +
> > +	wait(&status);
> > +	shmdt(buf);
> > +	shmctl(shmid, IPC_RMID, NULL);
> > +}
> > +
> > +void setup(void)
> > +{
> > +	long mem_total, hpage_size;
> > +
> > +	tst_require_root(NULL);
> > +
> > +	mem_total = read_meminfo("MemTotal:") * 1024;
> > +	if (mem_total < 2L*SIZE) {
> > +		tst_resm(TINFO, "Total memory should greater than 2G.");
> > +		tst_exit();
> > +	}
> > +
> > +	orig_hugepages = get_sys_tune("nr_hugepages");
> > +	hpage_size = read_meminfo("Hugepagesize:") * 1024;
> > +
> > +	hugepages = (orig_hugepages * hpage_size + SIZE) / hpage_size;
> > +	set_sys_tune("nr_hugepages", hugepages, 1);
> > +
> > +	huge_total = read_meminfo("HugePages_Total:");
> > +	huge_free = read_meminfo("HugePages_Free:");
> > +
> > +	if (huge_total != hugepages || huge_free != hugepages)
> > +		tst_brkm(TCONF, cleanup,
> > +			"Maybe huge pages not enough for test.");
> > +
> > +	TEST_PAUSE;
> > +}
> > +
> > +void cleanup(void)
> > +{
> > +	TEST_CLEANUP;
> > +	set_sys_tune("nr_hugepages", orig_hugepages, 0);
> > +}
> > --
> > 1.8.3.1
> > 
> 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
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] mem/hugeshmat: new case for hugepage leak inspection
  2015-01-06 14:07           ` Li Wang
@ 2015-01-07 12:32             ` Jan Stancek
  2015-01-07 14:59               ` Li Wang
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Stancek @ 2015-01-07 12:32 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp-list





----- Original Message -----
> From: "Li Wang" <liwang@redhat.com>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp-list@lists.sourceforge.net
> Sent: Tuesday, 6 January, 2015 3:07:16 PM
> Subject: Re: [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak inspection
> 
> > I'm assuming that both absolute address and sleep is not necessary.
> > I think I'll take some recent kernel, revert that patch and try to
> > reproduce
> > the failure.
> 
> Hi Jan,
> 
> I just tried kernel-3.10.0+ without the fixed patch, and I hit a CPU stuck
> issue
> with absolute address and sleep(3).

I tried the same with 2.6.18-92.el5. When I revert the patch I can reproduce the leak.
sleep(3) doesn't seem to have any effect, I think we can safely remove it.
Attaching at BOUNDARY however seems necessary. As soon as I change shmat to use "NULL",
the leak no longer happens, I'm not sure why that is.

+        if (huge_total != hugepages || huge_free != hugepages)
This condition in setup() seems to strict. I think we don't need all hugepages
to be free when test starts. 

Regards,
Jan


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
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] mem/hugeshmat: new case for hugepage leak inspection
  2015-01-07 12:32             ` Jan Stancek
@ 2015-01-07 14:59               ` Li Wang
  2015-01-26 16:48                 ` Cyril Hrubis
  0 siblings, 1 reply; 13+ messages in thread
From: Li Wang @ 2015-01-07 14:59 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list


> ----- Original Message -----
> > From: "Li Wang" <liwang@redhat.com>
> > To: "Jan Stancek" <jstancek@redhat.com>
> > Cc: ltp-list@lists.sourceforge.net
> > Sent: Tuesday, 6 January, 2015 3:07:16 PM
> > Subject: Re: [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak
> > inspection
> > 
> > > I'm assuming that both absolute address and sleep is not necessary.
> > > I think I'll take some recent kernel, revert that patch and try to
> > > reproduce
> > > the failure.
> > 
> > Hi Jan,
> > 
> > I just tried kernel-3.10.0+ without the fixed patch, and I hit a CPU stuck
> > issue
> > with absolute address and sleep(3).
> 
> I tried the same with 2.6.18-92.el5. When I revert the patch I can reproduce
> the leak.
> sleep(3) doesn't seem to have any effect, I think we can safely remove it.
> Attaching at BOUNDARY however seems necessary. As soon as I change shmat to
> use "NULL",
> the leak no longer happens, I'm not sure why that is.
> 
> +        if (huge_total != hugepages || huge_free != hugepages)
> This condition in setup() seems to strict. I think we don't need all
> hugepages
> to be free when test starts.
> 

Agreed! Seems the case should be like this:


Signed-off-by: Li Wang <liwang@redhat.com>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 runtest/hugetlb                                    |   1 +
 testcases/kernel/mem/.gitignore                    |   1 +
 .../kernel/mem/hugetlb/hugeshmat/hugeshmat04.c     | 164 +++++++++++++++++++++
 3 files changed, 166 insertions(+)
 create mode 100644 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c

diff --git a/runtest/hugetlb b/runtest/hugetlb
index 3eaf14c..805141d 100644
--- a/runtest/hugetlb
+++ b/runtest/hugetlb
@@ -10,6 +10,7 @@ hugemmap05_3 hugemmap05 -s -m
 hugeshmat01 hugeshmat01 -i 5
 hugeshmat02 hugeshmat02 -i 5
 hugeshmat03 hugeshmat03 -i 5
+hugeshmat04 hugeshamt04 -i 5
 
 hugeshmctl01 hugeshmctl01 -i 5
 hugeshmctl02 hugeshmctl02 -i 5
diff --git a/testcases/kernel/mem/.gitignore b/testcases/kernel/mem/.gitignore
index f96964c..c531563 100644
--- a/testcases/kernel/mem/.gitignore
+++ b/testcases/kernel/mem/.gitignore
@@ -6,6 +6,7 @@
 /hugetlb/hugeshmat/hugeshmat01
 /hugetlb/hugeshmat/hugeshmat02
 /hugetlb/hugeshmat/hugeshmat03
+/hugetlb/hugeshmat/hugeshmat04
 /hugetlb/hugeshmctl/hugeshmctl01
 /hugetlb/hugeshmctl/hugeshmctl02
 /hugetlb/hugeshmctl/hugeshmctl03
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
new file mode 100644
index 0000000..d6d2d4c
--- /dev/null
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
@@ -0,0 +1,164 @@
+/*
+ *   Copyright (c) Linux Test Project, 2014
+ *
+ *   This program is free software;  you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ *   the GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program;  if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ *   02110-1301 USA
+ */
+
+/*
+ * NAME
+ * 	hugeshmat04.c
+ *
+ * DESCRIPTION
+ *	hugeshmat04 - test for hugepage leak inspection.
+ *
+ *      Description of Problem:
+ *         When over 1GB shered memory was alocated in hugepage, the hugepage
+ *         is not released though process finished.
+ *
+ *         You need more than 2GB memory in test job
+ *
+ *	Test results:
+ *	   Successed: No regression found.
+ *	   Failed:    Regression detected.
+ *
+ * HISTORY
+ * 	05/2014 - Written by Fujistu Corp.
+ *	12/2014 - Port to LTP by Li Wang.
+ *
+ * RESTRICTIONS
+ * 	test must be run at root
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/shm.h>
+#include <sys/wait.h>
+
+#include "test.h"
+#include "mem.h"
+
+#define SIZE	(1024 * 1024 * 1024)
+#define BOUNDARY (1024 * 1024 * 1024)
+
+char *TCID = "hugeshmat04";
+int TST_TOTAL = 3;
+
+static long huge_total;
+static long huge_free;
+static long huge_free2;
+static long hugepages;
+static long orig_hugepages;
+
+static void shared_hugepage(void);
+
+int main(int ac, char **av)
+{
+	int lc, i;
+	const char *msg;
+
+	msg = parse_opts(ac, av, NULL, NULL);
+	if (msg != NULL)
+		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+
+	setup();
+
+	for (lc = 0; TEST_LOOPING(lc); lc++) {
+		tst_count = 0;
+
+		for (i = 0; i < TST_TOTAL; i++) {
+
+			huge_free = read_meminfo("HugePages_Free:");
+			shared_hugepage();
+			huge_free2 = read_meminfo("HugePages_Free:");
+
+			if (huge_free2 != huge_free)
+				tst_brkm(TFAIL, cleanup,
+					"Test failed. Hugepage leak inspection.");
+			else
+				tst_resm(TPASS, "No regression found.");
+		}
+	}
+
+	cleanup();
+	tst_exit();
+}
+
+void shared_hugepage(void)
+{
+	pid_t pid;
+	int status, shmid;
+	size_t size = (size_t)SIZE;
+	void *buf;
+
+	shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | 0777);
+	if (shmid < 0)
+		tst_brkm(TBROK | TERRNO, cleanup, "shmget");
+
+	buf = shmat(shmid, (void *)BOUNDARY, SHM_RND | 0777);
+	if (buf == (void *)-1) {
+		shmctl(shmid, IPC_RMID, NULL);
+		tst_brkm(TBROK | TERRNO, cleanup, "shmat");
+	}
+
+	memset(buf, 2, size);
+	pid = fork();
+
+	if (pid == 0)
+		exit(1);
+	else if (pid < 0)
+		tst_brkm(TBROK | TERRNO, cleanup, "fork");
+
+	wait(&status);
+	shmdt(buf);
+	shmctl(shmid, IPC_RMID, NULL);
+}
+
+void setup(void)
+{
+	long mem_total, hpage_size;
+
+	tst_require_root(NULL);
+
+	mem_total = read_meminfo("MemTotal:") * 1024;
+	if (mem_total < 2L*SIZE) {
+		tst_resm(TINFO, "Total memory should greater than 2G.");
+		tst_exit();
+	}
+
+	orig_hugepages = get_sys_tune("nr_hugepages");
+	hpage_size = read_meminfo("Hugepagesize:") * 1024;
+
+	hugepages = (orig_hugepages * hpage_size + SIZE) / hpage_size;
+	set_sys_tune("nr_hugepages", hugepages, 1);
+
+	huge_total = read_meminfo("HugePages_Total:");
+	if (huge_total != hugepages)
+		tst_brkm(TCONF, cleanup,
+			"Maybe huge pages not enough for test.");
+
+	TEST_PAUSE;
+}
+
+void cleanup(void)
+{
+	TEST_CLEANUP;
+	set_sys_tune("nr_hugepages", orig_hugepages, 0);
+}
-- 
1.8.3.1

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
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] mem/hugeshmat: new case for hugepage leak inspection
  2015-01-07 14:59               ` Li Wang
@ 2015-01-26 16:48                 ` Cyril Hrubis
  0 siblings, 0 replies; 13+ messages in thread
From: Cyril Hrubis @ 2015-01-26 16:48 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp-list

Hi!
> Signed-off-by: Li Wang <liwang@redhat.com>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
>  runtest/hugetlb                                    |   1 +
>  testcases/kernel/mem/.gitignore                    |   1 +
>  .../kernel/mem/hugetlb/hugeshmat/hugeshmat04.c     | 164 +++++++++++++++++++++
>  3 files changed, 166 insertions(+)
>  create mode 100644 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> 
> diff --git a/runtest/hugetlb b/runtest/hugetlb
> index 3eaf14c..805141d 100644
> --- a/runtest/hugetlb
> +++ b/runtest/hugetlb
> @@ -10,6 +10,7 @@ hugemmap05_3 hugemmap05 -s -m
>  hugeshmat01 hugeshmat01 -i 5
>  hugeshmat02 hugeshmat02 -i 5
>  hugeshmat03 hugeshmat03 -i 5
> +hugeshmat04 hugeshamt04 -i 5
>  
>  hugeshmctl01 hugeshmctl01 -i 5
>  hugeshmctl02 hugeshmctl02 -i 5
> diff --git a/testcases/kernel/mem/.gitignore b/testcases/kernel/mem/.gitignore
> index f96964c..c531563 100644
> --- a/testcases/kernel/mem/.gitignore
> +++ b/testcases/kernel/mem/.gitignore
> @@ -6,6 +6,7 @@
>  /hugetlb/hugeshmat/hugeshmat01
>  /hugetlb/hugeshmat/hugeshmat02
>  /hugetlb/hugeshmat/hugeshmat03
> +/hugetlb/hugeshmat/hugeshmat04
>  /hugetlb/hugeshmctl/hugeshmctl01
>  /hugetlb/hugeshmctl/hugeshmctl02
>  /hugetlb/hugeshmctl/hugeshmctl03
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> new file mode 100644
> index 0000000..d6d2d4c
> --- /dev/null
> +++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> @@ -0,0 +1,164 @@
> +/*
> + *   Copyright (c) Linux Test Project, 2014
> + *
> + *   This program is free software;  you can redistribute it and/or modify
> + *   it under the terms of the GNU General Public License as published by
> + *   the Free Software Foundation; either version 2 of the License, or
> + *   (at your option) any later version.
> + *
> + *   This program is distributed in the hope that it will be useful,
> + *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
> + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
> + *   the GNU General Public License for more details.
> + *
> + *   You should have received a copy of the GNU General Public License
> + *   along with this program;  if not, write to the Free Software
> + *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> + *   02110-1301 USA
> + */
> +
> +/*
> + * NAME
> + * 	hugeshmat04.c
> + *
> + * DESCRIPTION
> + *	hugeshmat04 - test for hugepage leak inspection.
> + *
> + *      Description of Problem:
> + *         When over 1GB shered memory was alocated in hugepage, the hugepage
> + *         is not released though process finished.
> + *
> + *         You need more than 2GB memory in test job
> + *
> + *	Test results:
> + *	   Successed: No regression found.
> + *	   Failed:    Regression detected.
> + *
> + * HISTORY
> + * 	05/2014 - Written by Fujistu Corp.
> + *	12/2014 - Port to LTP by Li Wang.
> + *
> + * RESTRICTIONS
> + * 	test must be run at root
> + */

The NAME, Test Results and RESTRICTONS are useless, please remove these.
What really matters here is the test DESCRIPTION. It should say that
it's a regression test for shared hugepage leak and a few more details
about the conditions that are needed to make it happen.

> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <unistd.h>
> +#include <fcntl.h>
> +#include <string.h>
> +#include <sys/mman.h>
> +#include <sys/types.h>
> +#include <sys/shm.h>
> +#include <sys/wait.h>
> +
> +#include "test.h"
> +#include "mem.h"
> +
> +#define SIZE	(1024 * 1024 * 1024)
> +#define BOUNDARY (1024 * 1024 * 1024)
> +
> +char *TCID = "hugeshmat04";
> +int TST_TOTAL = 3;
> +
> +static long huge_total;
> +static long huge_free;
> +static long huge_free2;
> +static long hugepages;
> +static long orig_hugepages;
> +
> +static void shared_hugepage(void);
> +
> +int main(int ac, char **av)
> +{
> +	int lc, i;
> +	const char *msg;
> +
> +	msg = parse_opts(ac, av, NULL, NULL);
> +	if (msg != NULL)
> +		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
> +
> +	setup();
> +
> +	for (lc = 0; TEST_LOOPING(lc); lc++) {
> +		tst_count = 0;
> +
> +		for (i = 0; i < TST_TOTAL; i++) {
> +
> +			huge_free = read_meminfo("HugePages_Free:");
> +			shared_hugepage();
> +			huge_free2 = read_meminfo("HugePages_Free:");
> +
> +			if (huge_free2 != huge_free)
> +				tst_brkm(TFAIL, cleanup,
> +					"Test failed. Hugepage leak inspection.");
> +			else
> +				tst_resm(TPASS, "No regression found.");
> +		}
> +	}
> +
> +	cleanup();
> +	tst_exit();
> +}
> +
> +void shared_hugepage(void)
> +{
> +	pid_t pid;
> +	int status, shmid;
> +	size_t size = (size_t)SIZE;
> +	void *buf;
> +
> +	shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | 0777);
> +	if (shmid < 0)
> +		tst_brkm(TBROK | TERRNO, cleanup, "shmget");
> +
> +	buf = shmat(shmid, (void *)BOUNDARY, SHM_RND | 0777);
> +	if (buf == (void *)-1) {
> +		shmctl(shmid, IPC_RMID, NULL);
> +		tst_brkm(TBROK | TERRNO, cleanup, "shmat");
> +	}
> +
> +	memset(buf, 2, size);
> +	pid = fork();
> +
> +	if (pid == 0)
> +		exit(1);
> +	else if (pid < 0)
> +		tst_brkm(TBROK | TERRNO, cleanup, "fork");
> +
> +	wait(&status);
> +	shmdt(buf);
> +	shmctl(shmid, IPC_RMID, NULL);
> +}
> +
> +void setup(void)
> +{
> +	long mem_total, hpage_size;
> +
> +	tst_require_root(NULL);
> +
> +	mem_total = read_meminfo("MemTotal:") * 1024;
> +	if (mem_total < 2L*SIZE) {

Why don't we keep the computation here in kilobytes? It's less prone to
potential overflows...

> +		tst_resm(TINFO, "Total memory should greater than 2G.");
> +		tst_exit();

		Should be:
		tst_brmk(TCONF, "Test requires more than 2GB of RAM");

> +	}
> +
> +	orig_hugepages = get_sys_tune("nr_hugepages");
> +	hpage_size = read_meminfo("Hugepagesize:") * 1024;
> +
> +	hugepages = (orig_hugepages * hpage_size + SIZE) / hpage_size;
> +	set_sys_tune("nr_hugepages", hugepages, 1);
> +
> +	huge_total = read_meminfo("HugePages_Total:");
> +	if (huge_total != hugepages)
> +		tst_brkm(TCONF, cleanup,
> +			"Maybe huge pages not enough for test.");
> +
> +	TEST_PAUSE;
> +}
> +
> +void cleanup(void)
> +{
> +	TEST_CLEANUP;
> +	set_sys_tune("nr_hugepages", orig_hugepages, 0);
> +}

Otherwise it looks fine.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
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] mem/hugeshmat: new case for hugepage leak inspection
       [not found] <1422336738-617-1-git-send-email-liwang@redhat.com>
@ 2015-01-27 15:31 ` Cyril Hrubis
  0 siblings, 0 replies; 13+ messages in thread
From: Cyril Hrubis @ 2015-01-27 15:31 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp-list

Hi!
> +void setup(void)
> +{
> +	long mem_total, hpage_size;
> +
> +	tst_require_root(NULL);
> +
> +	mem_total = read_meminfo("MemTotal:");
> +	if (mem_total < 2L*1024*1024) {
> +		tst_resm(TINFO, "Test requires more than 2GB of RAM");
> +		tst_exit();

This should be:

                tst_brmk(TCONF, "Test requires more than 2GB of RAM");

As I said in the last mail.

Otherwise it looks fine.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
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

* [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak inspection
       [not found] <1419737900-6117-1-git-send-email-liwang@redhat.com>
@ 2014-12-28  4:06 ` Li Wang
  0 siblings, 0 replies; 13+ messages in thread
From: Li Wang @ 2014-12-28  4:06 UTC (permalink / raw)
  To: ltp-list

Description of Problem:
    When over 1GB shared memory was alocated in hugepage, the hugepage
    is not released though process finished.

Signed-off-by: Li Wang <liwang@redhat.com>
---
 runtest/hugetlb                                    |   1 +
 testcases/kernel/mem/.gitignore                    |   1 +
 .../kernel/mem/hugetlb/hugeshmat/hugeshmat04.c     | 185 +++++++++++++++++++++
 3 files changed, 187 insertions(+)
 create mode 100644 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c

diff --git a/runtest/hugetlb b/runtest/hugetlb
index 3eaf14c..805141d 100644
--- a/runtest/hugetlb
+++ b/runtest/hugetlb
@@ -10,6 +10,7 @@ hugemmap05_3 hugemmap05 -s -m
 hugeshmat01 hugeshmat01 -i 5
 hugeshmat02 hugeshmat02 -i 5
 hugeshmat03 hugeshmat03 -i 5
+hugeshmat04 hugeshamt04 -i 5
 
 hugeshmctl01 hugeshmctl01 -i 5
 hugeshmctl02 hugeshmctl02 -i 5
diff --git a/testcases/kernel/mem/.gitignore b/testcases/kernel/mem/.gitignore
index f96964c..c531563 100644
--- a/testcases/kernel/mem/.gitignore
+++ b/testcases/kernel/mem/.gitignore
@@ -6,6 +6,7 @@
 /hugetlb/hugeshmat/hugeshmat01
 /hugetlb/hugeshmat/hugeshmat02
 /hugetlb/hugeshmat/hugeshmat03
+/hugetlb/hugeshmat/hugeshmat04
 /hugetlb/hugeshmctl/hugeshmctl01
 /hugetlb/hugeshmctl/hugeshmctl02
 /hugetlb/hugeshmctl/hugeshmctl03
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
new file mode 100644
index 0000000..efa8a73
--- /dev/null
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
@@ -0,0 +1,185 @@
+/*
+ *   Copyright (c) Linux Test Project, 2014
+ *
+ *   This program is free software;  you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ *   the GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program;  if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * 	hugeshmat04.c
+ *
+ * DESCRIPTION
+ *	hugeshmat04 - test for hugepage leak inspection.
+ *
+ *      Description of Problem:
+ *          When over 1GB shered memory was alocated in hugepage, the hugepage
+ *          is not released though process finished.
+ *
+ *          You need more than 2GB memory in test job
+ *
+ *	Return value:
+ *	  0: 	 Test successed.  No regression found.
+ *	  1: 	 Test failed.  Maybe memory shortage.  Please retry testing.
+ *	  2: 	 Test failed.  Regression detected.
+ *	  other: Test failed.  Other problem detected.
+ *
+ * HISTORY
+ * 	05/2014 - Written by Fujistu Corp.
+ *	12/2014 - Port to LTP by Li Wang.
+ *
+ * RESTRICTIONS
+ * 	test must be run at root
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/shm.h>
+#include <sys/wait.h>
+
+#include "test.h"
+#include "mem.h"
+
+#define SIZE	(1024 * 1024 * 1024)
+#define BOUNDARY (1024 * 1024 * 1024)
+
+char *TCID = "hugeshmat04";
+int TST_TOTAL = 3;
+
+static int huge_total;
+static int huge_free;
+static int huge_free2;
+static long hugepages;
+static long orig_hugepages;
+
+static int shared_hugepage(void);
+
+
+int main(int ac, char **av)
+{
+	int lc, i, ret;
+	const char *msg;
+
+	msg = parse_opts(ac,av, NULL, NULL);
+	if (msg != NULL)
+		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+
+	setup();
+
+	for (lc = 0; TEST_LOOPING(lc); lc++) {
+		tst_count = 0;
+
+		for (i = 0; i < TST_TOTAL; i++) {
+			huge_total = read_meminfo("HugePages_Total:");
+			huge_free = read_meminfo("HugePages_Free:");
+
+			if (huge_total == hugepages && huge_free == hugepages) {
+				ret = shared_hugepage();
+
+				huge_free2 = read_meminfo("HugePages_Free:");
+				if (huge_free2 != huge_free)
+					ret = 2;
+			} else {
+				ret = 1;
+			}
+
+			switch (ret) {
+			case 0:
+				tst_resm(TPASS, 
+					"No regression found.");
+				break;
+			case 1:
+				tst_brkm(TFAIL, cleanup, 
+					"Test failed. Maybe memory shortage.");
+				break;
+			case 2:
+				tst_brkm(TFAIL, cleanup, 
+					"Test failed. Hugepage leak inspection.");
+				break;
+			default:
+				tst_brkm(TFAIL, cleanup, 
+					"Test failed. Other problem detected.");
+				break;
+			}
+
+		}
+	}
+	cleanup();
+	tst_exit();
+}
+
+int shared_hugepage(void)
+{
+	pid_t pid;
+	int status, shmid;
+	size_t size = (size_t)SIZE;
+	void *buf;
+
+	shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | 0777);
+	if (shmid < 0)
+		tst_brkm(TBROK | TERRNO, cleanup, "shmget");
+
+	buf = shmat(shmid, (void *)BOUNDARY, SHM_RND | 0777);
+	if ( buf == (void *)-1 ) {
+		shmctl(shmid, IPC_RMID, NULL);
+		tst_brkm(TBROK | TERRNO, cleanup, "shmat");
+	}
+
+	memset(buf, 2, size);
+	sleep(3);
+	pid = fork();
+
+	if (pid == 0)
+	        exit(1);
+	else if (pid < 0)
+		tst_brkm(TBROK | TERRNO, cleanup, "fork");
+
+	wait(&status);
+	shmdt(buf);
+	shmctl(shmid, IPC_RMID, NULL);
+
+	return 0;
+}
+
+void setup(void)
+{
+	long mem_total, hpage_size;
+
+	tst_require_root(NULL);
+
+	mem_total = read_meminfo("MemTotal:");
+	if (mem_total < 2097152) {
+		tst_resm(TINFO, "Total memory should greater than 2G.");
+		tst_exit();
+	}
+
+	orig_hugepages = get_sys_tune("nr_hugepages");
+	hpage_size = read_meminfo("Hugepagesize:");
+
+	hugepages = (orig_hugepages * hpage_size + 1048576) / hpage_size;
+	set_sys_tune("nr_hugepages", hugepages, 1);
+
+	TEST_PAUSE;
+}
+
+void cleanup(void)
+{
+	TEST_CLEANUP;
+	set_sys_tune("nr_hugepages", orig_hugepages, 0);
+}
-- 
1.8.3.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
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

* [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak inspection
@ 2014-12-28  3:20 Li Wang
  0 siblings, 0 replies; 13+ messages in thread
From: Li Wang @ 2014-12-28  3:20 UTC (permalink / raw)
  To: ltp-list

Description of Problem:
    When over 1GB shared memory was alocated in hugepage, the hugepage
    is not released though process finished.

Signed-off-by: Li Wang <liwang@redhat.com>
---
 runtest/hugetlb                                    |   1 +
 testcases/kernel/mem/.gitignore                    |   1 +
 .../kernel/mem/hugetlb/hugeshmat/hugeshmat04.c     | 185 +++++++++++++++++++++
 3 files changed, 187 insertions(+)
 create mode 100644 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c

diff --git a/runtest/hugetlb b/runtest/hugetlb
index 3eaf14c..805141d 100644
--- a/runtest/hugetlb
+++ b/runtest/hugetlb
@@ -10,6 +10,7 @@ hugemmap05_3 hugemmap05 -s -m
 hugeshmat01 hugeshmat01 -i 5
 hugeshmat02 hugeshmat02 -i 5
 hugeshmat03 hugeshmat03 -i 5
+hugeshmat04 hugeshamt04 -i 5
 
 hugeshmctl01 hugeshmctl01 -i 5
 hugeshmctl02 hugeshmctl02 -i 5
diff --git a/testcases/kernel/mem/.gitignore b/testcases/kernel/mem/.gitignore
index f96964c..c531563 100644
--- a/testcases/kernel/mem/.gitignore
+++ b/testcases/kernel/mem/.gitignore
@@ -6,6 +6,7 @@
 /hugetlb/hugeshmat/hugeshmat01
 /hugetlb/hugeshmat/hugeshmat02
 /hugetlb/hugeshmat/hugeshmat03
+/hugetlb/hugeshmat/hugeshmat04
 /hugetlb/hugeshmctl/hugeshmctl01
 /hugetlb/hugeshmctl/hugeshmctl02
 /hugetlb/hugeshmctl/hugeshmctl03
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
new file mode 100644
index 0000000..515947b
--- /dev/null
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
@@ -0,0 +1,185 @@
+/*
+ *   Copyright (c) Linux Test Project, 2014
+ *
+ *   This program is free software;  you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ *   the GNU General Public License for more details.
+ *  
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program;  if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * 	hugeshmat04.c
+ * 
+ * DESCRIPTION
+ *	hugeshmat04 - test for hugepage leak inspection.
+ *     
+ *      Description of Problem:
+ *          When over 1GB shered memory was alocated in hugepage, the hugepage
+ *          is not released though process finished.
+ *
+ *          You need more than 2GB memory in test job
+ *
+ *	Return value:
+ *	  0: 	 Test successed.  No regression found.
+ *	  1: 	 Test failed.  Maybe memory shortage.  Please retry testing.
+ *	  2: 	 Test failed.  Regression detected.
+ *	  other: Test failed.  Other problem detected.
+ *
+ * HISTORY
+ * 	05/2014 - Written by Fujistu Corp. 
+ *     	12/2014 - Port to LTP by Li Wang.
+ *    
+ * RESTRICTIONS
+ * 	test must be run at root
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/shm.h>
+#include <sys/wait.h>
+
+#include "test.h"
+#include "mem.h"
+
+#define SIZE	(1024 * 1024 * 1024)
+#define BOUNDARY (1024 * 1024 * 1024)
+
+char *TCID = "hugeshmat04";
+int TST_TOTAL = 3;
+
+static int huge_total;
+static int huge_free;
+static int huge_free2;
+static long hugepages;
+static long orig_hugepages;
+
+static int shared_hugepage(void);
+
+
+int main(int ac, char **av)
+{
+	int lc, i, ret;
+	const char *msg;
+
+	msg = parse_opts(ac,av, NULL, NULL);
+	if (msg != NULL)
+		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+
+	setup();
+
+	for (lc = 0; TEST_LOOPING(lc); lc++) {
+		tst_count = 0;
+
+		for (i = 0; i < TST_TOTAL; i++) {
+			huge_total = read_meminfo("HugePages_Total:");
+			huge_free = read_meminfo("HugePages_Free:");
+
+			if (huge_total == hugepages && huge_free == hugepages) {
+				ret = shared_hugepage();
+
+				huge_free2 = read_meminfo("HugePages_Free:");
+				if (huge_free2 != huge_free)
+					ret = 2;
+			} else {
+				ret = 1;
+			}
+			
+			switch (ret) {
+			case 0:
+				tst_resm(TPASS, 
+					"No regression found.");
+				break;
+			case 1:
+				tst_brkm(TFAIL, cleanup, 
+					"Test failed. Maybe memory shortage.");
+				break;
+			case 2:
+				tst_brkm(TFAIL, cleanup, 
+					"Test failed. Hugepage leak inspection.");
+				break;
+			default:
+				tst_brkm(TFAIL, cleanup, 
+					"Test failed. Other problem detected.");
+				break;
+			}
+
+		}
+	}
+	cleanup();
+	tst_exit();
+}
+
+int shared_hugepage(void)
+{
+	pid_t pid;
+	int status, shmid;
+	size_t size = (size_t)SIZE;
+	void *buf;
+
+	shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | 0777);
+	if (shmid < 0)
+		tst_brkm(TBROK | TERRNO, cleanup, "shmget");
+
+	buf = shmat(shmid, (void *)BOUNDARY, SHM_RND | 0777);
+	if ( buf == (void *)-1 ) {
+		shmctl(shmid, IPC_RMID, NULL);
+		tst_brkm(TBROK | TERRNO, cleanup, "shmat");
+	}
+
+	memset(buf, 2, size);
+	sleep(3);
+	pid = fork();
+	
+	if (pid == 0)
+	        exit(1);
+	else if (pid < 0)
+	 	tst_brkm(TBROK | TERRNO, cleanup, "fork");
+	
+	wait(&status);
+	shmdt(buf);
+	shmctl(shmid, IPC_RMID, NULL);
+
+	return 0;
+}
+
+void setup(void)
+{
+	long mem_total, hpage_size;
+	
+	tst_require_root(NULL);
+
+	mem_total = read_meminfo("MemTotal:");
+	if (mem_total < 2097152) {
+		tst_resm(TINFO, "Total memory should greater than 2G.");
+		tst_exit();
+	}
+
+	orig_hugepages = get_sys_tune("nr_hugepages");
+	hpage_size = read_meminfo("Hugepagesize:");
+	
+	hugepages = (orig_hugepages * hpage_size + 1048576) / hpage_size;
+	set_sys_tune("nr_hugepages", hugepages, 1);
+	
+	TEST_PAUSE;
+}
+
+void cleanup(void)
+{
+	TEST_CLEANUP;
+	set_sys_tune("nr_hugepages", orig_hugepages, 0);
+}
-- 
1.8.3.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
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

end of thread, other threads:[~2015-01-27 15:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-27  7:13 [LTP] [PATCH] mem/hugeshmat: new case for hugepage leak inspection Li Wang
2014-12-30  9:23 ` Jan Stancek
2015-01-04  3:10   ` Li Wang
2015-01-05 10:16     ` Jan Stancek
2015-01-06  9:51       ` Li Wang
2015-01-06 10:35         ` Jan Stancek
2015-01-06 14:07           ` Li Wang
2015-01-07 12:32             ` Jan Stancek
2015-01-07 14:59               ` Li Wang
2015-01-26 16:48                 ` Cyril Hrubis
2014-12-28  3:20 Li Wang
     [not found] <1419737900-6117-1-git-send-email-liwang@redhat.com>
2014-12-28  4:06 ` Li Wang
     [not found] <1422336738-617-1-git-send-email-liwang@redhat.com>
2015-01-27 15:31 ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.