This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 3/5] On a Linux kernel ask explicitely for a huge page in ggc
- From: Andi Kleen <andi at firstfloor dot org>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Andi Kleen <ak at linux dot intel dot com>
- Date: Sun, 9 Oct 2011 21:55:39 +0200
- Subject: [PATCH 3/5] On a Linux kernel ask explicitely for a huge page in ggc
- References: <1318190141-1220-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
Benchmarks show slightly faster build times on a kernel
build, near the measurement error unfortunately.
This will only work with a recent glibc that defines MADV_HUGEPAGE.
2011-10-08 Andi Kleen <ak@linux.intel.com>
* ggc-page.c (alloc_page): Add madvise for hugepage
---
gcc/ggc-page.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index 1f52b56..6e08cda 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -779,6 +779,11 @@ alloc_page (unsigned order)
page = alloc_anon (NULL, G.pagesize * GGC_QUIRE_SIZE);
+#if defined(HAVE_MADVISE) && defined(MADV_HUGEPAGE)
+ /* Kernel, I would like to have hugepages, please. */
+ madvise(page, G.pagesize * GGC_QUIRE_SIZE, MADV_HUGEPAGE);
+#endif
+
/* This loop counts down so that the chain will be in ascending
memory order. */
for (i = GGC_QUIRE_SIZE - 1; i >= 1; i--)
--
1.7.5.4