public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP]  [PATCH] mem.c: check whether MADV_MERGEABLE is available
@ 2013-05-17  2:32 DAN LI
  2013-05-17  6:52 ` Jan Stancek
  2013-05-17  7:23 ` Wanlong Gao
  0 siblings, 2 replies; 3+ messages in thread
From: DAN LI @ 2013-05-17  2:32 UTC (permalink / raw)
  To: LTP list

Before using MADV_MERGEABLE, check whether it's available by macro
HAVE_MADV_MERGEABLE.

Signed-off-by: DAN LI <li.dan@cn.fujitsu.com>
---
 testcases/kernel/mem/lib/mem.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index 7cda3c5..9bc926e 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -494,8 +494,10 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages)
 			    MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
 		if (memory[i] == MAP_FAILED)
 			tst_brkm(TBROK|TERRNO, tst_exit, "mmap");
+#ifdef HAVE_MADV_MERGEABLE
 		if (madvise(memory[i], length, MADV_MERGEABLE) == -1)
 			tst_brkm(TBROK|TERRNO, tst_exit, "madvise");
+#endif

 #if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
 	&& HAVE_MPOL_CONSTANTS
-- 
1.7.11.rc0

------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2013-05-17  7:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-17  2:32 [LTP] [PATCH] mem.c: check whether MADV_MERGEABLE is available DAN LI
2013-05-17  6:52 ` Jan Stancek
2013-05-17  7:23 ` Wanlong Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox