Skip to contentSkip to conversation

mem.c: check whether MADV_MERGEABLE is available

PATCH Applied DAN LI 3 participants 3 messages May 17, 2013

lore
Share & tools
lore

DAN LI

author
#0 lore raw

PATCH 1/1 mem.c: check whether MADV_MERGEABLE is available

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

---
 testcases/kernel/mem/lib/mem.c | 2 ++
 1 file changed, 2 insertions(+)
testcases/kernel/mem/lib/mem.c +2 -0
index 7cda3c5..9bc926e 100644
@@ -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
Signature · 12 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Reviewed-by on v1 1/1
#1 lore raw

----- Original Message -----

Quoted 9 lines

From: "DAN LI" <[email protected]>
To: "LTP list" <[email protected]>
Sent: Friday, 17 May, 2013 4:32:16 AM
Subject: [LTP] [PATCH] mem.c: check whether MADV_MERGEABLE is available

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

Small and straightforward change.

Quoted 22 lines
---
 testcases/kernel/mem/lib/mem.c | 2 ++
 1 file changed, 2 insertions(+)
testcases/kernel/mem/lib/mem.c +2 -1
index 7cda3c5..9bc926e 100644
@@ -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

Quoted 11 lines

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Applied
#2 lore raw
In reply to DAN LI
Quoted 4 lines · DAN LI

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

Applied, thank you.

Wanlong Gao

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list