From: Oliver O'Halloran <oohall@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: linux-mm@kvack.org, Oliver O'Halloran <oohall@gmail.com>
Subject: [PATCH 2/6] powerpc/vmemmap: Reshuffle vmemmap_free()
Date: Tue, 23 May 2017 14:05:20 +1000 [thread overview]
Message-ID: <20170523040524.13717-2-oohall@gmail.com> (raw)
In-Reply-To: <20170523040524.13717-1-oohall@gmail.com>
Removes an indentation level and shuffles some code around to make the
following patch cleaner. No functional changes.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
v1 -> v2: Remove broken initialiser
---
arch/powerpc/mm/init_64.c | 48 ++++++++++++++++++++++++-----------------------
1 file changed, 25 insertions(+), 23 deletions(-)
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index ec84b31c6c86..8851e4f5dbab 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -234,13 +234,15 @@ static unsigned long vmemmap_list_free(unsigned long start)
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_order = get_order(page_size);
start = _ALIGN_DOWN(start, page_size);
pr_debug("vmemmap_free %lx...%lx\n", start, end);
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
@@ -251,29 +253,29 @@ void __ref vmemmap_free(unsigned long start, unsigned long end)
continue;
addr = vmemmap_list_free(start);
- if (addr) {
- struct page *page = pfn_to_page(addr >> PAGE_SHIFT);
-
- if (PageReserved(page)) {
- /* allocated from bootmem */
- if (page_size < PAGE_SIZE) {
- /*
- * this shouldn't happen, but if it is
- * the case, leave the memory there
- */
- WARN_ON_ONCE(1);
- } else {
- unsigned int nr_pages =
- 1 << get_order(page_size);
- while (nr_pages--)
- free_reserved_page(page++);
- }
- } else
- free_pages((unsigned long)(__va(addr)),
- get_order(page_size));
-
- vmemmap_remove_mapping(start, page_size);
+ if (!addr)
+ continue;
+
+ page = pfn_to_page(addr >> PAGE_SHIFT);
+ nr_pages = 1 << page_order;
+
+ if (PageReserved(page)) {
+ /* allocated from bootmem */
+ if (page_size < PAGE_SIZE) {
+ /*
+ * this shouldn't happen, but if it is
+ * the case, leave the memory there
+ */
+ WARN_ON_ONCE(1);
+ } else {
+ while (nr_pages--)
+ free_reserved_page(page++);
+ }
+ } else {
+ free_pages((unsigned long)(__va(addr)), page_order);
}
+
+ vmemmap_remove_mapping(start, page_size);
}
}
#endif
--
2.9.3
next prev parent reply other threads:[~2017-05-23 4:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-23 4:05 [PATCH 1/6] powerpc/mm: Wire up hpte_removebolted for powernv Oliver O'Halloran
2017-05-23 4:05 ` Oliver O'Halloran [this message]
2017-05-23 4:05 ` [PATCH 3/6] powerpc/vmemmap: Add altmap support Oliver O'Halloran
2017-05-23 9:25 ` Balbir Singh
2017-05-23 4:05 ` [PATCH 4/6] powerpc/mm: Add devmap support for ppc64 Oliver O'Halloran
2017-05-23 4:23 ` Aneesh Kumar K.V
2017-05-23 6:42 ` Oliver O'Halloran
2017-05-23 10:40 ` Balbir Singh
2017-05-24 2:17 ` Oliver O'Halloran
2017-05-23 4:05 ` [PATCH 5/6] mm, x86: Add ARCH_HAS_ZONE_DEVICE Oliver O'Halloran
2017-05-23 6:42 ` Ingo Molnar
2017-05-23 9:20 ` Balbir Singh
2017-05-23 4:05 ` [PATCH 6/6] powerpc/mm: Enable ZONE_DEVICE on powerpc Oliver O'Halloran
2017-05-23 9:21 ` Balbir Singh
2017-05-23 9:27 ` [PATCH 1/6] powerpc/mm: Wire up hpte_removebolted for powernv Balbir Singh
2017-05-25 0:02 ` Rashmica Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170523040524.13717-2-oohall@gmail.com \
--to=oohall@gmail.com \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).