All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] kernel/mem/lib/mem.c: fix compilation warnings
@ 2014-04-28  8:47 Xiaoguang Wang
  2014-04-28  8:47 ` [LTP] [PATCH 2/2] kernel/mem/lib/mem.c: do the necessary cleanup work Xiaoguang Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Xiaoguang Wang @ 2014-04-28  8:47 UTC (permalink / raw)
  To: ltp-list

Functions declared in testcases/kernel/mem/include/_private.h is not
implemented and used, so delete it.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
---
 testcases/kernel/mem/include/_private.h | 22 ----------------------
 testcases/kernel/mem/include/mem.h      |  2 +-
 testcases/kernel/mem/lib/mem.c          | 25 +++++++++++++++----------
 3 files changed, 16 insertions(+), 33 deletions(-)
 delete mode 100644 testcases/kernel/mem/include/_private.h

diff --git a/testcases/kernel/mem/include/_private.h b/testcases/kernel/mem/include/_private.h
deleted file mode 100644
index d34d417..0000000
--- a/testcases/kernel/mem/include/_private.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef __INTERNAL_H
-#define __INTERNAL_H
-/* Internal APIs */
-
-/* OOM */
-static int  _alloc_mem(long int length, int testcase);
-static void _test_alloc(int testcase, int lite);
-
-/* KSM */
-static void _check(char *path, long int value);
-static void _group_check(int run, int pages_shared, int pages_sharing,
-		int pages_volatile, int pages_unshared,
-		int sleep_millisecs, int pages_to_scan);
-static void _verify(char **memory, char value, int proc, int start, int end,
-		int start2, int end2);
-
-/* cpuset/memcg */
-static void _gather_cpus(char *cpus, long nd);
-
-/* shared */
-
-#endif /* __INTERNAL_H */
diff --git a/testcases/kernel/mem/include/mem.h b/testcases/kernel/mem/include/mem.h
index 342166e..746164c 100644
--- a/testcases/kernel/mem/include/mem.h
+++ b/testcases/kernel/mem/include/mem.h
@@ -23,7 +23,7 @@ static inline void set_node(unsigned long *array, unsigned int node)
 
 static inline void clean_node(unsigned long *array)
 {
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < MAXNODES / BITS_PER_LONG; i++)
 		array[i] &= 0UL;
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index 188a5ef..f145a2a 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -21,7 +21,6 @@
 #include "usctest.h"
 #include "safe_macros.h"
 #include "safe_file_ops.h"
-#include "_private.h"
 #include "mem.h"
 #include "numa_helper.h"
 
@@ -256,15 +255,15 @@ void write_memcg(void)
 	SAFE_FILE_PRINTF(NULL, MEMCG_PATH_NEW "/tasks", "%d", getpid());
 }
 
-static struct ksm_merge_data {
+struct ksm_merge_data {
 	char data;
-	int mergeable_size;
+	unsigned int mergeable_size;
 };
 
 static void ksm_child_memset(int child_num, int size, int total_unit,
 		 struct ksm_merge_data ksm_merge_data, char **memory)
 {
-	int i, j;
+	int i = 0, j;
 	int unit = size / total_unit;
 
 	tst_resm(TINFO, "child %d continues...", child_num);
@@ -280,7 +279,7 @@ static void ksm_child_memset(int child_num, int size, int total_unit,
 	}
 
 	for (j = 0; j < total_unit; j++) {
-		for (i = 0; i < unit * MB; i++)
+		for (i = 0; (unsigned int)i < unit * MB; i++)
 			memory[j][i] = ksm_merge_data.data;
 	}
 
@@ -358,7 +357,7 @@ static void stop_ksm_children(int *child, int num)
 
 static void resume_ksm_children(int *child, int num)
 {
-	int k, status;
+	int k;
 
 	tst_resm(TINFO, "resume all children.");
 	for (k = 0; k < num; k++) {
@@ -474,7 +473,11 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages)
 	int num_nodes, *nodes;
 	unsigned long length;
 	unsigned long pagesize;
+
+#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
+	&& HAVE_MPOL_CONSTANTS
 	unsigned long nmask[MAXNODES / BITS_PER_LONG] = { 0 };
+#endif
 
 	ret = get_allowed_nodes_arr(NH_MEMS|NH_CPUS, &num_nodes, &nodes);
 	if (ret != 0)
@@ -620,7 +623,8 @@ static int alloc_transparent_hugepages(int nr_thps, int hg_aligned)
 static void khugepaged_scan_done(void)
 {
 	int changing = 1, count = 0, interval;
-	long old_pages_collapsed, old_max_ptes_none, old_pages_to_scan;
+	long old_pages_collapsed = 0, old_max_ptes_none = 0,
+		old_pages_to_scan = 0;
 	long pages_collapsed = 0, max_ptes_none = 0, pages_to_scan = 0;
 
 	/*
@@ -703,6 +707,7 @@ void test_transparent_hugepage(int nr_children, int nr_thps,
 		tst_resm(TCONF, "Not enough memory for testing");
 
 	hugepagesize = read_meminfo("Hugepagesize:");
+	tst_resm(TINFO, "The current Hugepagesize is %luMB", hugepagesize / KB);
 
 	pids = malloc(nr_children * sizeof(int));
 	if (pids == NULL)
@@ -853,7 +858,7 @@ void write_cpuset_files(char *prefix, char *filename, char *buf)
 		} else
 			tst_brkm(TBROK | TERRNO, cleanup, "open %s", path);
 	}
-	if (write(fd, buf, strlen(buf)) != strlen(buf))
+	if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf))
 		tst_brkm(TBROK | TERRNO, cleanup, "write %s", path);
 	close(fd);
 }
@@ -902,7 +907,7 @@ void umount_mem(char *path, char *path_new)
 	if ((fd != -1) && (fp != NULL)) {
 		while (fgets(value, BUFSIZ, fp) != NULL)
 			if (write(fd, value, strlen(value) - 1)
-			    != strlen(value) - 1)
+			    != (ssize_t)strlen(value) - 1)
 				tst_resm(TWARN | TERRNO, "write %s", s);
 	}
 	if (fd != -1)
@@ -957,7 +962,7 @@ unsigned int get_a_numa_node(void (*cleanup_fn) (void))
 	ret = get_allowed_nodes(NH_MEMS | NH_CPUS, 1, &nd1);
 	switch (ret) {
 	case 0:
-		tst_resm(TINFO, "get node%lu.", nd1);
+		tst_resm(TINFO, "get node%u.", nd1);
 		return nd1;
 	case -3:
 		tst_brkm(TCONF, cleanup_fn, "requires a NUMA system that has "
-- 
1.8.2.1


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [LTP] [PATCH 2/2] kernel/mem/lib/mem.c: do the necessary cleanup work
  2014-04-28  8:47 [LTP] [PATCH 1/2] kernel/mem/lib/mem.c: fix compilation warnings Xiaoguang Wang
@ 2014-04-28  8:47 ` Xiaoguang Wang
  2014-04-28 10:56   ` Stanislav Kholmanskikh
  2014-04-28 10:29 ` [LTP] [PATCH 1/2] kernel/mem/lib/mem.c: fix compilation warnings Stanislav Kholmanskikh
  2014-05-05  6:13 ` Wanlong Gao
  2 siblings, 1 reply; 6+ messages in thread
From: Xiaoguang Wang @ 2014-04-28  8:47 UTC (permalink / raw)
  To: ltp-list

Oom01 case will modify "/proc/sys/vm/overcommit_memory" to have tests. In most systems,
the overcommit_memory's default value is 0. When running oom01, if KSM configuration
is not enabled, "tst_brkm(TCONF, NULL, ...)" will be called, in this case, we will forget
to execute the restore operation defined in cleanup, and this will impact other test cases
in LTP, for example, fork14 in RHEL5 will succeed unexpectedly.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
---
 testcases/kernel/mem/lib/mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index f145a2a..69a9014 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -146,7 +146,7 @@ void testoom(int mempolicy, int lite)
 	oom(MLOCK, lite);
 
 	if (access(PATH_KSM, F_OK) == -1)
-		tst_brkm(TCONF, NULL, "KSM configuration is not enabled");
+		tst_brkm(TCONF, cleanup, "KSM configuration is not enabled");
 
 	tst_resm(TINFO, "start OOM testing for KSM pages.");
 	oom(KSM, lite);
-- 
1.8.2.1


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH 1/2] kernel/mem/lib/mem.c: fix compilation warnings
  2014-04-28  8:47 [LTP] [PATCH 1/2] kernel/mem/lib/mem.c: fix compilation warnings Xiaoguang Wang
  2014-04-28  8:47 ` [LTP] [PATCH 2/2] kernel/mem/lib/mem.c: do the necessary cleanup work Xiaoguang Wang
@ 2014-04-28 10:29 ` Stanislav Kholmanskikh
  2014-05-05  6:13 ` Wanlong Gao
  2 siblings, 0 replies; 6+ messages in thread
From: Stanislav Kholmanskikh @ 2014-04-28 10:29 UTC (permalink / raw)
  To: ltp-list

Hi!

On 04/28/2014 12:47 PM, Xiaoguang Wang wrote:
> Functions declared in testcases/kernel/mem/include/_private.h is not
> implemented and used, so delete it.
>
> Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>

Acked-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>

> ---
>   testcases/kernel/mem/include/_private.h | 22 ----------------------
>   testcases/kernel/mem/include/mem.h      |  2 +-
>   testcases/kernel/mem/lib/mem.c          | 25 +++++++++++++++----------
>   3 files changed, 16 insertions(+), 33 deletions(-)
>   delete mode 100644 testcases/kernel/mem/include/_private.h
>

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH 2/2] kernel/mem/lib/mem.c: do the necessary cleanup work
  2014-04-28  8:47 ` [LTP] [PATCH 2/2] kernel/mem/lib/mem.c: do the necessary cleanup work Xiaoguang Wang
@ 2014-04-28 10:56   ` Stanislav Kholmanskikh
  2014-04-28 11:23     ` Xiaoguang Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Stanislav Kholmanskikh @ 2014-04-28 10:56 UTC (permalink / raw)
  To: ltp-list

Hi!

On 04/28/2014 12:47 PM, Xiaoguang Wang wrote:
> Oom01 case will modify "/proc/sys/vm/overcommit_memory" to have tests. In most systems,
> the overcommit_memory's default value is 0. When running oom01, if KSM configuration
> is not enabled, "tst_brkm(TCONF, NULL, ...)" will be called, in this case, we will forget
> to execute the restore operation defined in cleanup, and this will impact other test cases
> in LTP, for example, fork14 in RHEL5 will succeed unexpectedly.
>
> Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
> ---
>   testcases/kernel/mem/lib/mem.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
> index f145a2a..69a9014 100644
> --- a/testcases/kernel/mem/lib/mem.c
> +++ b/testcases/kernel/mem/lib/mem.c
> @@ -146,7 +146,7 @@ void testoom(int mempolicy, int lite)
>   	oom(MLOCK, lite);
>
>   	if (access(PATH_KSM, F_OK) == -1)
> -		tst_brkm(TCONF, NULL, "KSM configuration is not enabled");
> +		tst_brkm(TCONF, cleanup, "KSM configuration is not enabled");

In the current situation the OOM test cases will exit with TCONF if no 
KSM is setup on the system.

But is KSM the absolute requirement for the test cases?

And could we execute the KSM part of testoom() only if KSM is enabled?

Thanks.

>
>   	tst_resm(TINFO, "start OOM testing for KSM pages.");
>   	oom(KSM, lite);
>

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH 2/2] kernel/mem/lib/mem.c: do the necessary cleanup work
  2014-04-28 10:56   ` Stanislav Kholmanskikh
@ 2014-04-28 11:23     ` Xiaoguang Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Xiaoguang Wang @ 2014-04-28 11:23 UTC (permalink / raw)
  To: Stanislav Kholmanskikh; +Cc: ltp-list

Hi,

On 04/28/2014 06:56 PM, Stanislav Kholmanskikh wrote:
> Hi!
>
> On 04/28/2014 12:47 PM, Xiaoguang Wang wrote:
>> Oom01 case will modify "/proc/sys/vm/overcommit_memory" to have tests. In most systems,
>> the overcommit_memory's default value is 0. When running oom01, if KSM configuration
>> is not enabled, "tst_brkm(TCONF, NULL, ...)" will be called, in this case, we will forget
>> to execute the restore operation defined in cleanup, and this will impact other test cases
>> in LTP, for example, fork14 in RHEL5 will succeed unexpectedly.
>>
>> Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
>> ---
>>   testcases/kernel/mem/lib/mem.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
>> index f145a2a..69a9014 100644
>> --- a/testcases/kernel/mem/lib/mem.c
>> +++ b/testcases/kernel/mem/lib/mem.c
>> @@ -146,7 +146,7 @@ void testoom(int mempolicy, int lite)
>>   	oom(MLOCK, lite);
>>
>>   	if (access(PATH_KSM, F_OK) == -1)
>> -		tst_brkm(TCONF, NULL, "KSM configuration is not enabled");
>> +		tst_brkm(TCONF, cleanup, "KSM configuration is not enabled");
> In the current situation the OOM test cases will exit with TCONF if no 
> KSM is setup on the system.
>
> But is KSM the absolute requirement for the test cases?
According to my understanding about oom01, this is not a mandatory requirement :-)
>
> And could we execute the KSM part of testoom() only if KSM is enabled?
Yeah, sound reasonable, thanks. I will make a new version soon.

Regards,
Xiaoguang Wang
>
> Thanks.
>
>>   	tst_resm(TINFO, "start OOM testing for KSM pages.");
>>   	oom(KSM, lite);
>>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
> unparalleled scalability from the best Selenium testing platform available.
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH 1/2] kernel/mem/lib/mem.c: fix compilation warnings
  2014-04-28  8:47 [LTP] [PATCH 1/2] kernel/mem/lib/mem.c: fix compilation warnings Xiaoguang Wang
  2014-04-28  8:47 ` [LTP] [PATCH 2/2] kernel/mem/lib/mem.c: do the necessary cleanup work Xiaoguang Wang
  2014-04-28 10:29 ` [LTP] [PATCH 1/2] kernel/mem/lib/mem.c: fix compilation warnings Stanislav Kholmanskikh
@ 2014-05-05  6:13 ` Wanlong Gao
  2 siblings, 0 replies; 6+ messages in thread
From: Wanlong Gao @ 2014-05-05  6:13 UTC (permalink / raw)
  To: Xiaoguang Wang; +Cc: ltp-list

On 04/28/2014 04:47 PM, Xiaoguang Wang wrote:
> Functions declared in testcases/kernel/mem/include/_private.h is not
> implemented and used, so delete it.
> 
> Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
> ---
>  testcases/kernel/mem/include/_private.h | 22 ----------------------
>  testcases/kernel/mem/include/mem.h      |  2 +-
>  testcases/kernel/mem/lib/mem.c          | 25 +++++++++++++++----------
>  3 files changed, 16 insertions(+), 33 deletions(-)
>  delete mode 100644 testcases/kernel/mem/include/_private.h

Applied, thank you.

Wanlong Gao


------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-05-05  6:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-28  8:47 [LTP] [PATCH 1/2] kernel/mem/lib/mem.c: fix compilation warnings Xiaoguang Wang
2014-04-28  8:47 ` [LTP] [PATCH 2/2] kernel/mem/lib/mem.c: do the necessary cleanup work Xiaoguang Wang
2014-04-28 10:56   ` Stanislav Kholmanskikh
2014-04-28 11:23     ` Xiaoguang Wang
2014-04-28 10:29 ` [LTP] [PATCH 1/2] kernel/mem/lib/mem.c: fix compilation warnings Stanislav Kholmanskikh
2014-05-05  6:13 ` Wanlong Gao

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.