Signed-off-by: Andrea Arcangeli --- --- /var/tmp/portage/sys-devel/gcc-4.4.2/work/gcc-4.4.2/gcc/ggc-page.c 2008= -07-28 16:33:56.000000000 +0200 +++ /tmp/gcc-4.4.2/gcc/ggc-page.c 2010-04-25 06:01:32.829753566 +0200 @@ -450,6 +450,11 @@ #define BITMAP_SIZE(Num_objects) \ (CEIL ((Num_objects), HOST_BITS_PER_LONG) * sizeof(long)) =20 +#ifdef __x86_64__ +#define HPAGE_SIZE (2*1024*1024) +#define GGC_QUIRE_SIZE 512 +#endif + /* Allocate pages in chunks of this size, to throttle calls to memory allocation routines. The first page is used, the rest go onto the free list. This cannot be larger than HOST_BITS_PER_INT for the @@ -654,6 +659,23 @@ #ifdef HAVE_MMAP_ANON char *page =3D (char *) mmap (pref, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); +#ifdef HPAGE_SIZE + if (!(size & (HPAGE_SIZE-1)) && + page !=3D (char *) MAP_FAILED && (size_t) page & (HPAGE_SIZE-1)) { + char *old_page; + munmap(page, size); + page =3D (char *) mmap (pref, size + HPAGE_SIZE-1, + PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + old_page =3D page; + page =3D (char *) (((size_t)page + HPAGE_SIZE-1) + & ~(HPAGE_SIZE-1)); + if (old_page !=3D page) + munmap(old_page, page-old_page); + if (page !=3D old_page + HPAGE_SIZE-1) + munmap(page+size, old_page+HPAGE_SIZE-1-page); + } +#endif #endif #ifdef HAVE_MMAP_DEV_ZERO char *page =3D (char *) mmap (pref, size, PROT_READ | PROT_WRITE,