diff options
| author | Mike Rapoport (Microsoft) <rppt@kernel.org> | 2026-03-23 10:48:29 +0300 |
|---|---|---|
| committer | Mike Rapoport (Microsoft) <rppt@kernel.org> | 2026-04-01 11:19:45 +0300 |
| commit | 25ee3aff9996f22e1b8b27fb284efb285e2fb025 (patch) | |
| tree | e242b6ee01af0c12fea6310a961c1fd79831c01e | |
| parent | c12c3e1507809ad1fc0448f51c933f52e17d13cd (diff) | |
| download | linux-25ee3aff9996f22e1b8b27fb284efb285e2fb025.tar.xz | |
powerpc: fadump: pair alloc_pages_exact() with free_pages_exact()
fadump allocates buffers with alloc_pages_exact(), but then marks them
as reserved and frees using free_reserved_area().
This is completely unnecessary and the pages allocated with
alloc_pages_exact() can be naturally freed with free_pages_exact().
Replace freeing of memory in fadump_free_buffer() with
free_pages_exact() and simplify allocation code so that it won't mark
allocated pages as reserved.
Link: https://patch.msgid.link/20260323074836.3653702-3-rppt@kernel.org
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
| -rw-r--r-- | arch/powerpc/kernel/fadump.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index 4ebc333dd786..501d43bf18f3 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -775,24 +775,12 @@ void __init fadump_update_elfcore_header(char *bufp) static void *__init fadump_alloc_buffer(unsigned long size) { - unsigned long count, i; - struct page *page; - void *vaddr; - - vaddr = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO); - if (!vaddr) - return NULL; - - count = PAGE_ALIGN(size) / PAGE_SIZE; - page = virt_to_page(vaddr); - for (i = 0; i < count; i++) - mark_page_reserved(page + i); - return vaddr; + return alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO); } static void fadump_free_buffer(unsigned long vaddr, unsigned long size) { - free_reserved_area((void *)vaddr, (void *)(vaddr + size), -1, NULL); + free_pages_exact((void *)vaddr, size); } s32 __init fadump_setup_cpu_notes_buf(u32 num_cpus) |
