* 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.
This commit is contained in:
Vladimir Serbinenko 2013-11-18 16:58:55 +01:00
parent 1bbb796799
commit 39ff43c579
2 changed files with 10 additions and 1 deletions

View file

@ -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> 2013-11-18 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkrescue.c (main): Fix typo. * util/grub-mkrescue.c (main): Fix typo.

View 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. /* Mark find as a start marker for next allocation to fasten it.
This will have side effect of fragmenting memory as small This will have side effect of fragmenting memory as small
pieces before this will be un-used. */ 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; return p + 1;
} }