From: Andi Kleen <a...@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 <a...@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

Reply via email to