This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 3/5] On a Linux kernel ask explicitely for a huge page in ggc


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]