]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add missing page rounding of a page_entry
authorAndi Kleen <ak@linux.intel.com>
Sat, 29 Oct 2011 01:01:34 +0000 (01:01 +0000)
committerAndi Kleen <ak@gcc.gnu.org>
Sat, 29 Oct 2011 01:01:34 +0000 (01:01 +0000)
This one place in ggc forgot to round page_entry->bytes to the
next page boundary, which lead to all the heuristics in freeing to
check for continuous memory failing. Round here too, like all other
allocators already do. The memory consumed should be the same
for MMAP because the kernel would round anyways. It may slightly
increase memory usage when malloc groups are used.

This will also increase the hitrate on the free page list
slightly.

gcc/:

2011-10-18  Andi Kleen  <ak@linux.intel.com>

* ggc-page.c (alloc_pages): Always round up to entry_size.

From-SVN: r180647

gcc/ChangeLog
gcc/ggc-page.c

index 6686f7d8296915cd373e240d8d6224bd19f5b28a..65df15b4005a369241045b5a5f61f080b7429987 100644 (file)
@@ -1,3 +1,7 @@
+2011-10-18  Andi Kleen  <ak@linux.intel.com>
+
+       * ggc-page.c (alloc_pages): Always round up entry_size.
+
 2011-10-19  Andi Kleen  <ak@linux.intel.com>
 
        * Makefile.in (MOSTLYCLEANFILES): Add gcc-ar/nm/ranlib.
index 617a49348d77dd3155f336e1f8d6ed8787c0af9f..077bc8e2beef5d54118ba7dc4d12cab0ca16f39f 100644 (file)
@@ -737,6 +737,7 @@ alloc_page (unsigned order)
   entry_size = num_objects * OBJECT_SIZE (order);
   if (entry_size < G.pagesize)
     entry_size = G.pagesize;
+  entry_size = ROUND_UP (entry_size, G.pagesize);
 
   entry = NULL;
   page = NULL;