linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: cpw@sgi.com
Cc: linux-numa@vger.kernel.org, Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 7/8] memhog: add option to disable transparent huge pages
Date: Wed, 14 Dec 2011 11:38:37 -0800	[thread overview]
Message-ID: <1323891518-1493-7-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1323891518-1493-1-git-send-email-andi@firstfloor.org>

From: Andi Kleen <ak@linux.intel.com>

Transparent Hugepages confuse the page accounting in the
test suite. Add an option to memhog (-H) to disable them.
---
 memhog.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/memhog.c b/memhog.c
index 2bc4251..b22f097 100755
--- a/memhog.c
+++ b/memhog.c
@@ -20,6 +20,7 @@
 #include <sys/mman.h>
 #include <sys/fcntl.h>
 #include <string.h>
+#include <stdbool.h>
 #include "numa.h"
 #include "numaif.h"
 #include "util.h"
@@ -37,6 +38,7 @@ void usage(void)
 {
 	printf("memhog [-rNUM] size[kmg] [policy [nodeset]]\n");
 	printf("-rNUM repeat memset NUM times\n");
+	printf("-H disable transparent hugepages\n");
 	print_policies();
 	exit(1);
 }
@@ -66,6 +68,7 @@ int main(int ac, char **av)
 	int loose = 0;
 	int i;
 	int fd = -1;
+	bool disable_hugepage = false;
 
 	nodes = numa_allocate_nodemask();
 	gnodes = numa_allocate_nodemask();
@@ -80,6 +83,9 @@ int main(int ac, char **av)
 		case 'r':
 			repeat = atoi(av[1] + 2);
 			break;
+		case 'H':
+			disable_hugepage = true;
+			break;
 		default:	
 			usage();
 		}
@@ -113,6 +119,9 @@ int main(int ac, char **av)
 	
 	if (mbind(map, length, policy, nodes->maskp, nodes->size, 0) < 0)
 		terr("mbind");
+
+	if (disable_hugepage)
+		madvise(map, length, MADV_NOHUGEPAGE);
 	
 	gpolicy = -1;
 	if (get_mempolicy(&gpolicy, gnodes->maskp, gnodes->size, map, MPOL_F_ADDR) < 0)
-- 
1.7.5.4

  parent reply	other threads:[~2011-12-14 19:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14 19:38 [PATCH 1/8] Add support for a "same" numamask to numactl Andi Kleen
2011-12-14 19:38 ` [PATCH 2/8] Use constructors for numa_init/exit Andi Kleen
2011-12-14 19:38 ` [PATCH 3/8] Use glibc syscall if possible Andi Kleen
2011-12-14 19:38 ` [PATCH 4/8] Run full test suite before exiting Andi Kleen
2011-12-14 19:38 ` [PATCH 5/8] Add IO affinity support to libnuma Andi Kleen
2011-12-14 19:38 ` [PATCH 6/8] Clean regression test temp files Andi Kleen
2011-12-14 19:38 ` Andi Kleen [this message]
2011-12-14 19:38 ` [PATCH 8/8] Disable transparent huge pages in test suite Andi Kleen
2011-12-19 15:12 ` numactl/libnuma 2.0.8-rc3 Cliff Wickman

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=1323891518-1493-7-git-send-email-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=ak@linux.intel.com \
    --cc=cpw@sgi.com \
    --cc=linux-numa@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).