Skip to contentSkip to conversation

efi: Increase default memory allocation to 32MB

PATCH In review Daniel Axtens 3 participants 4 messages Sep 19, 2022 – Sep 27, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi: Increase default memory allocation to 32MB

We have multiple reports of things being slower with a 1MB initial static allocation, and a report (more difficult to nail down) of a boot failure as a result of the smaller initial allocation.

Make the initial memory allocation 32MB.

---
 grub-core/kern/efi/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/kern/efi/mm.c +1 -1
index d290c9a76270..3705b8b1b465 100644
@@ -39,7 +39,7 @@
 #define MEMORY_MAP_SIZE	0x3000
 
 /* The default heap size for GRUB itself in bytes.  */
-#define DEFAULT_HEAP_SIZE	0x100000
+#define DEFAULT_HEAP_SIZE	0x2000000
 
 static void *finish_mmap_buf = 0;
 static grub_efi_uintn_t finish_mmap_size = 0;
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

Adding some folks who may be interested in this thing too...

Quoted 7 lines · Daniel Axtens

We have multiple reports of things being slower with a 1MB initial static allocation, and a report (more difficult to nail down) of a boot failure as a result of the smaller initial allocation.

Make the initial memory allocation 32MB.

However, I think we should consider [1] patch set too. I will be looking at it in the following days.

Daniel

[1] https://lists.gnu.org/archive/html/grub-devel/2022-09/msg00080.html

Quoted 17 lines
---
 grub-core/kern/efi/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/kern/efi/mm.c +1 -1
index d290c9a76270..3705b8b1b465 100644
@@ -39,7 +39,7 @@
 #define MEMORY_MAP_SIZE	0x3000
 
 /* The default heap size for GRUB itself in bytes.  */
-#define DEFAULT_HEAP_SIZE	0x100000
+#define DEFAULT_HEAP_SIZE	0x2000000
 
 static void *finish_mmap_buf = 0;
 static grub_efi_uintn_t finish_mmap_size = 0;
#2 lore raw
Quoted 11 lines · Daniel Kiper

Adding some folks who may be interested in this thing too...

Quoted 7 lines · Daniel Axtens

We have multiple reports of things being slower with a 1MB initial static allocation, and a report (more difficult to nail down) of a boot failure as a result of the smaller initial allocation.

Make the initial memory allocation 32MB.

Quoted 8 lines

However, I think we should consider [1] patch set too. I will be looking at it in the following days.

Daniel

[1] https://lists.gnu.org/archive/html/grub-devel/2022-09/msg00080.html

Agreed, we should definitely merge some form of fixes to improve the page request patterns. I'm also happy with bumping the default heap size in addition.

Out of curiosity: do we have any kind of minimum system requirements documented somewhere that would allow us to come up with a default heap size?

Patrick

Quoted 18 lines
Quoted 18 lines
---
 grub-core/kern/efi/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/kern/efi/mm.c +1 -1
index d290c9a76270..3705b8b1b465 100644
@@ -39,7 +39,7 @@
 #define MEMORY_MAP_SIZE	0x3000
 
 /* The default heap size for GRUB itself in bytes.  */
-#define DEFAULT_HEAP_SIZE	0x100000
+#define DEFAULT_HEAP_SIZE	0x2000000
 
 static void *finish_mmap_buf = 0;
 static grub_efi_uintn_t finish_mmap_size = 0;
#3 lore raw
Quoted 17 lines · Patrick Steinhardt
Quoted 16 lines · Daniel Kiper

Adding some folks who may be interested in this thing too...

Quoted 7 lines · Daniel Axtens

We have multiple reports of things being slower with a 1MB initial static allocation, and a report (more difficult to nail down) of a boot failure as a result of the smaller initial allocation.

Make the initial memory allocation 32MB.

However, I think we should consider [1] patch set too. I will be looking at it in the following days.

Quoted 7 lines
Quoted 3 lines

Daniel

[1] https://lists.gnu.org/archive/html/grub-devel/2022-09/msg00080.html

Agreed, we should definitely merge some form of fixes to improve the page request patterns. I'm also happy with bumping the default heap size in addition.

Agreed also.

Quoted 5 lines

Out of curiosity: do we have any kind of minimum system requirements documented somewhere that would allow us to come up with a default heap size?

Heh. That'd be nice, and I think valuable, but my experience trying to drop HFS suggests that it might be very controversial.

Kind regards,
Daniel

Quoted 20 lines

Patrick

Quoted 18 lines
Quoted 18 lines
---
 grub-core/kern/efi/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/kern/efi/mm.c +1 -1
index d290c9a76270..3705b8b1b465 100644
@@ -39,7 +39,7 @@
 #define MEMORY_MAP_SIZE	0x3000
 
 /* The default heap size for GRUB itself in bytes.  */
-#define DEFAULT_HEAP_SIZE	0x100000
+#define DEFAULT_HEAP_SIZE	0x2000000
 
 static void *finish_mmap_buf = 0;
 static grub_efi_uintn_t finish_mmap_size = 0;