Skip to content

efi: Free memory on exit

Alexander Graf grub-devel 5 versions – Applied

Status from this message: Applied!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v62 patches 0 repliesNew
  2. v7 Latest2 patches 2 repliesApplied
  3. v52 patches 8 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v42 patches0 repliesSuperseded
v32 patches4 repliesSuperseded

Changes in v7 from the cover letter

- rewrite grub_efi_drop_alloc() according to Daniel's comments

Patches in v7 Applied

#Subject and filesSizeRepliesApplied
1/2efi: Move grub_reboot() into kernelgrub-core/Makefile.core.def grub-core/kern/efi/efi.c grub-core/lib/efi/reboot.c +1 more+11 -380 replies
2/2efi: Free malloc regions on exitgrub-core/kern/efi/init.c grub-core/kern/efi/mm.c include/grub/efi/efi.h+81 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v7 yet.

Read the v7 thread

Cover letter [PATCH v7 0/2] efi: Free memory on exit

When exiting grub, we currently leave the heap allocated. This means that if we exit and rerun grub, after a few iterations we can run into memory shortage.

This patch set frees the heap on exit. That way we can rerun grub many times without much problem.

v3 -> v4:

- Move grub_reboot to kern/efi/efi.c
- use dynamic list instead of static array at runtime
- use allocate_pool for list, so we are not bound by heap or random numbers
- remember all allocations, not just the heap

v4 -> v5:

- free dynamic list entries on allocation removal

v5 -> v6:

- move next ptr to last field
- s/start_addr/address/
- s/grub_efi_unremember_pages()/grub_efi_drop_alloc()/
- s/grub_efi_remember_pages()/grub_efi_store_alloc()/
- move grub_efi_drop_alloc after grub_efi_store_alloc
- s/grub2/GRUB/
- Make grub_efi_memory_fini comment more verbose
- Drop useless efi_allocated_memory = NULL; line

v6 -> v7:

- rewrite grub_efi_drop_alloc() according to Daniel's comments

Alexander Graf (2):
efi: Move grub_reboot() into kernel
efi: Free malloc regions on exit

 grub-core/Makefile.core.def |  4 ---
 grub-core/kern/efi/efi.c    |  9 ++++++
 grub-core/kern/efi/init.c   |  1 +
 grub-core/kern/efi/mm.c     | 79 +++++++++++++++++++++++++++++++++++++++++++++
 grub-core/lib/efi/reboot.c  | 33 -------------------
 include/grub/efi/efi.h      |  1 +
 include/grub/misc.h         |  3 +-
 7 files changed, 92 insertions(+), 38 deletions(-)
 delete mode 100644 grub-core/lib/efi/reboot.c
Signature · 1 line
2.12.3