Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+2 -14
+2 -14
arch/powerpc/kernel/fadump.c
··· 775 775 776 776 static void *__init fadump_alloc_buffer(unsigned long size) 777 777 { 778 - unsigned long count, i; 779 - struct page *page; 780 - void *vaddr; 781 - 782 - vaddr = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO); 783 - if (!vaddr) 784 - return NULL; 785 - 786 - count = PAGE_ALIGN(size) / PAGE_SIZE; 787 - page = virt_to_page(vaddr); 788 - for (i = 0; i < count; i++) 789 - mark_page_reserved(page + i); 790 - return vaddr; 778 + return alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO); 791 779 } 792 780 793 781 static void fadump_free_buffer(unsigned long vaddr, unsigned long size) 794 782 { 795 - free_reserved_area((void *)vaddr, (void *)(vaddr + size), -1, NULL); 783 + free_pages_exact((void *)vaddr, size); 796 784 } 797 785 798 786 s32 __init fadump_setup_cpu_notes_buf(u32 num_cpus)