From: pasha.tatashin@oracle.com (Pavel Tatashin)
To: linux-arm-kernel@lists.infradead.org
Subject: [v5 06/15] sparc64: simplify vmemmap_populate
Date: Thu, 3 Aug 2017 17:23:44 -0400 [thread overview]
Message-ID: <1501795433-982645-7-git-send-email-pasha.tatashin@oracle.com> (raw)
In-Reply-To: <1501795433-982645-1-git-send-email-pasha.tatashin@oracle.com>
Remove duplicating code by using common functions
vmemmap_pud_populate and vmemmap_pgd_populate.
Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
Reviewed-by: Steven Sistare <steven.sistare@oracle.com>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <bob.picco@oracle.com>
---
arch/sparc/mm/init_64.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index ba957b763c07..e18947e9ab6c 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -2567,30 +2567,19 @@ int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend,
vstart = vstart & PMD_MASK;
vend = ALIGN(vend, PMD_SIZE);
for (; vstart < vend; vstart += PMD_SIZE) {
- pgd_t *pgd = pgd_offset_k(vstart);
+ pgd_t *pgd = vmemmap_pgd_populate(vstart, node);
unsigned long pte;
pud_t *pud;
pmd_t *pmd;
- if (pgd_none(*pgd)) {
- pud_t *new = vmemmap_alloc_block(PAGE_SIZE, node);
+ if (!pgd)
+ return -ENOMEM;
- if (!new)
- return -ENOMEM;
- pgd_populate(&init_mm, pgd, new);
- }
-
- pud = pud_offset(pgd, vstart);
- if (pud_none(*pud)) {
- pmd_t *new = vmemmap_alloc_block(PAGE_SIZE, node);
-
- if (!new)
- return -ENOMEM;
- pud_populate(&init_mm, pud, new);
- }
+ pud = vmemmap_pud_populate(pgd, vstart, node);
+ if (!pud)
+ return -ENOMEM;
pmd = pmd_offset(pud, vstart);
-
pte = pmd_val(*pmd);
if (!(pte & _PAGE_VALID)) {
void *block = vmemmap_alloc_block(PMD_SIZE, node);
--
2.13.4
next prev parent reply other threads:[~2017-08-03 21:23 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-03 21:23 [v5 00/15] complete deferred page initialization Pavel Tatashin
2017-08-03 21:23 ` [v5 01/15] x86/mm: reserve only exiting low pages Pavel Tatashin
2017-08-03 21:23 ` [v5 02/15] x86/mm: setting fields in deferred pages Pavel Tatashin
2017-08-03 21:23 ` [v5 03/15] sparc64/mm: " Pavel Tatashin
2017-08-03 21:23 ` [v5 04/15] mm: discard memblock data later Pavel Tatashin
2017-08-03 21:23 ` [v5 05/15] mm: don't accessed uninitialized struct pages Pavel Tatashin
2017-08-03 21:23 ` Pavel Tatashin [this message]
2017-08-03 21:23 ` [v5 07/15] mm: defining memblock_virt_alloc_try_nid_raw Pavel Tatashin
2017-08-03 21:23 ` [v5 08/15] mm: zero struct pages during initialization Pavel Tatashin
2017-08-03 21:23 ` [v5 09/15] sparc64: optimized struct page zeroing Pavel Tatashin
2017-08-04 5:37 ` Sam Ravnborg
2017-08-04 13:50 ` Pasha Tatashin
2017-08-03 21:23 ` [v5 10/15] x86/kasan: explicitly zero kasan shadow memory Pavel Tatashin
2017-08-03 21:23 ` [v5 11/15] arm64/kasan: " Pavel Tatashin
2017-08-04 0:14 ` Ard Biesheuvel
2017-08-04 14:01 ` Pasha Tatashin
2017-08-03 21:23 ` [v5 12/15] mm: explicitly zero pagetable memory Pavel Tatashin
2017-08-03 21:23 ` [v5 13/15] mm: stop zeroing memory during allocation in vmemmap Pavel Tatashin
2017-08-03 21:23 ` [v5 14/15] mm: optimize early system hash allocations Pavel Tatashin
2017-08-03 21:23 ` [v5 15/15] mm: debug for raw alloctor Pavel Tatashin
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=1501795433-982645-7-git-send-email-pasha.tatashin@oracle.com \
--to=pasha.tatashin@oracle.com \
--cc=linux-arm-kernel@lists.infradead.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).