]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/kern/mm.c (grub_real_malloc): Don't update the pointer to
authorVladimir Serbinenko <phcoder@gmail.com>
Mon, 18 Nov 2013 15:58:55 +0000 (16:58 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Mon, 18 Nov 2013 15:58:55 +0000 (16:58 +0100)
current memory when allocating large chunks. This significantly
decreases memory fragmentation.

ChangeLog
grub-core/kern/mm.c

index aa39cb968913a6efc5441b4101b8eb752e3d35d5..ba6af6af65bd17dd24d97b39aec9a612e887fe7f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-11-18  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/kern/mm.c (grub_real_malloc): Don't update the pointer to
+       current memory when allocating large chunks. This significantly
+       decreases memory fragmentation.
+
 2013-11-18  Colin Watson  <cjwatson@ubuntu.com>
 
        * util/grub-mkrescue.c (main): Fix typo.
index 6111eef7edb295b28eb50b3c98b41127f824d55f..53f3475f5a0049f326b280a23c7ee7a7c68ac857 100644 (file)
@@ -298,7 +298,10 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align)
          /* Mark find as a start marker for next allocation to fasten it.
             This will have side effect of fragmenting memory as small
             pieces before this will be un-used.  */
-         *first = q;
+         /* So do it only for chunks under 64K.  */
+         if (n < (0x10000 >> GRUB_MM_ALIGN_LOG2)
+             || *first == p)
+           *first = q;
 
          return p + 1;
        }