From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andi Kleen Subject: [PATCH 7/8] memhog: add option to disable transparent huge pages Date: Wed, 14 Dec 2011 11:38:37 -0800 Message-ID: <1323891518-1493-7-git-send-email-andi@firstfloor.org> References: <1323891518-1493-1-git-send-email-andi@firstfloor.org> Return-path: In-Reply-To: <1323891518-1493-1-git-send-email-andi@firstfloor.org> Sender: linux-numa-owner@vger.kernel.org List-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: cpw@sgi.com Cc: linux-numa@vger.kernel.org, Andi Kleen From: Andi Kleen 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 #include #include +#include #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