Commit d7d9b612 authored by Oliver O'Halloran's avatar Oliver O'Halloran Committed by Michael Ellerman

powerpc/vmemmap: Reshuffle vmemmap_free()

Removes an indentation level and shuffles some code around to make the
following patch cleaner. No functional changes.
Reviewed-by: default avatarBalbir Singh <bsingharora@gmail.com>
Signed-off-by: default avatarOliver O'Halloran <oohall@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 65f7d049
...@@ -255,13 +255,15 @@ static unsigned long vmemmap_list_free(unsigned long start) ...@@ -255,13 +255,15 @@ static unsigned long vmemmap_list_free(unsigned long start)
void __ref vmemmap_free(unsigned long start, unsigned long end) void __ref vmemmap_free(unsigned long start, unsigned long end)
{ {
unsigned long page_size = 1 << mmu_psize_defs[mmu_vmemmap_psize].shift; unsigned long page_size = 1 << mmu_psize_defs[mmu_vmemmap_psize].shift;
unsigned long page_order = get_order(page_size);
start = _ALIGN_DOWN(start, page_size); start = _ALIGN_DOWN(start, page_size);
pr_debug("vmemmap_free %lx...%lx\n", start, end); pr_debug("vmemmap_free %lx...%lx\n", start, end);
for (; start < end; start += page_size) { for (; start < end; start += page_size) {
unsigned long addr; unsigned long nr_pages, addr;
struct page *page;
/* /*
* the section has already be marked as invalid, so * the section has already be marked as invalid, so
...@@ -272,29 +274,29 @@ void __ref vmemmap_free(unsigned long start, unsigned long end) ...@@ -272,29 +274,29 @@ void __ref vmemmap_free(unsigned long start, unsigned long end)
continue; continue;
addr = vmemmap_list_free(start); addr = vmemmap_list_free(start);
if (addr) { if (!addr)
struct page *page = pfn_to_page(addr >> PAGE_SHIFT); continue;
if (PageReserved(page)) { page = pfn_to_page(addr >> PAGE_SHIFT);
/* allocated from bootmem */ nr_pages = 1 << page_order;
if (page_size < PAGE_SIZE) {
/* if (PageReserved(page)) {
* this shouldn't happen, but if it is /* allocated from bootmem */
* the case, leave the memory there if (page_size < PAGE_SIZE) {
*/ /*
WARN_ON_ONCE(1); * this shouldn't happen, but if it is
} else { * the case, leave the memory there
unsigned int nr_pages = */
1 << get_order(page_size); WARN_ON_ONCE(1);
while (nr_pages--) } else {
free_reserved_page(page++); while (nr_pages--)
} free_reserved_page(page++);
} else }
free_pages((unsigned long)(__va(addr)), } else {
get_order(page_size)); free_pages((unsigned long)(__va(addr)), page_order);
vmemmap_remove_mapping(start, page_size);
} }
vmemmap_remove_mapping(start, page_size);
} }
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment