From: DAN LI <li.dan@cn.fujitsu.com>
To: LTP list <ltp-list@lists.sourceforge.net>
Subject: [LTP] [PATCH] mem.c: check whether MADV_MERGEABLE is available
Date: Fri, 17 May 2013 10:32:16 +0800 [thread overview]
Message-ID: <519596B0.2010807@cn.fujitsu.com> (raw)
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
next reply other threads:[~2013-05-17 2:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-17 2:32 DAN LI [this message]
2013-05-17 6:52 ` [LTP] [PATCH] mem.c: check whether MADV_MERGEABLE is available Jan Stancek
2013-05-17 7:23 ` Wanlong Gao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=519596B0.2010807@cn.fujitsu.com \
--to=li.dan@cn.fujitsu.com \
--cc=ltp-list@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox