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: Increase GGC_QUIRE_SIZE


When the memory allocator uses mmap to request memory from the kernel, it asks for GGC_QUIRE_SIZE pages at a time. GGC_QUIRE_SIZE could in principle be 1; it's set to a larger value for the sake of performance. In the current compiler it's 16.

16 is still a pretty tiny number; with the usual 4K pages it means we're asking for 64K at a time, and 64K doesn't go very far these days. This patch raises it to 256, meaning we'll typically be allocating memory in 1MB chunks. This helps performance in two ways. First, it's fewer calls to mmap. Second, kernels are happier dealing with a few large chunks than with many small ones. On Darwin, this patch improves compilation speed by about 2%; most of the reduction is in system time.

OK to commit to mainline?

--Matt

Index: gcc/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.5636
diff -p -r2.5636 ChangeLog
*** gcc/ChangeLog       26 Sep 2004 19:52:51 -0000      2.5636
--- gcc/ChangeLog       27 Sep 2004 01:20:59 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2004-09-26  Matt Austern  <austern@apple.com>
+
+       * ggc-page.c (GGC_QUIRE_SIZE): Bump up from 16 to 256 if we're
+       using mmap.
+
  2004-09-26  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>

* bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP,
Index: gcc/ggc-page.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ggc-page.c,v
retrieving revision 1.94
diff -p -r1.94 ggc-page.c
*** gcc/ggc-page.c 9 Sep 2004 13:53:59 -0000 1.94
--- gcc/ggc-page.c 27 Sep 2004 01:21:00 -0000
*************** static struct globals
*** 458,465 ****
/* 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
! in_use bitmask for page_group. */
! #define GGC_QUIRE_SIZE 16


  /* Initial guess as to how many page table entries we might need.  */
  #define INITIAL_PTE_COUNT 128
--- 458,472 ----
  /* 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
!    in_use bitmask for page_group.  Hosts that need a different value
!    can override this by defining GGC_QUIRE_SIZE explicitly. */
! #ifndef GGC_QUIRE_SIZE
! # ifdef USING_MMAP
! #  define GGC_QUIRE_SIZE 256
! # else
! #  define GGC_QUIRE_SIZE 16
! # endif
! #endif

  /* Initial guess as to how many page table entries we might need.  */
  #define INITIAL_PTE_COUNT 128


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