public inbox for openrisc@lists.librecores.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@linux.ibm.com>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH v4 4/6] openrisc: simplify pte_alloc_one_kernel()
Date: Mon, 31 Dec 2018 11:29:24 +0200	[thread overview]
Message-ID: <1546248566-14910-5-git-send-email-rppt@linux.ibm.com> (raw)
In-Reply-To: <1546248566-14910-1-git-send-email-rppt@linux.ibm.com>

The pte_alloc_one_kernel() function allocates a page using
__get_free_page(GFP_KERNEL) when mm initialization is complete and
memblock_phys_alloc() on the earlier stages. The physical address of the
page allocated with memblock_phys_alloc() is converted to the virtual
address and in the both cases the allocated page is cleared using
clear_page().

The code is simplified by replacing __get_free_page() with
get_zeroed_page() and by replacing memblock_phys_alloc() with
memblock_alloc().

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Acked-by: Stafford Horne <shorne@gmail.com>
---
 arch/openrisc/mm/ioremap.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c
index c969752..cfef989 100644
--- a/arch/openrisc/mm/ioremap.c
+++ b/arch/openrisc/mm/ioremap.c
@@ -123,13 +123,10 @@ pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm,
 {
 	pte_t *pte;
 
-	if (likely(mem_init_done)) {
-		pte = (pte_t *) __get_free_page(GFP_KERNEL);
-	} else {
-		pte = (pte_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
-	}
+	if (likely(mem_init_done))
+		pte = (pte_t *)get_zeroed_page(GFP_KERNEL);
+	else
+		pte = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
 
-	if (pte)
-		clear_page(pte);
 	return pte;
 }
-- 
2.7.4


  parent reply	other threads:[~2018-12-31  9:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-31  9:29 [OpenRISC] [PATCH v4 0/6] memblock: simplify several early memory allocation Mike Rapoport
2018-12-31  9:29 ` [OpenRISC] [PATCH v4 1/6] powerpc: prefer memblock APIs returning virtual address Mike Rapoport
2019-01-08 10:02   ` Christophe Leroy
2019-01-08 14:23     ` Mike Rapoport
2018-12-31  9:29 ` [OpenRISC] [PATCH v4 2/6] microblaze: prefer memblock API " Mike Rapoport
2018-12-31  9:29 ` [OpenRISC] [PATCH v4 3/6] sh: prefer memblock APIs " Mike Rapoport
2018-12-31  9:29 ` Mike Rapoport [this message]
2018-12-31  9:29 ` [OpenRISC] [PATCH v4 5/6] arch: simplify several early memory allocations Mike Rapoport
2018-12-31  9:29 ` [OpenRISC] [PATCH v4 6/6] arm, s390, unicore32: remove oneliner wrappers for memblock_alloc() Mike Rapoport

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=1546248566-14910-5-git-send-email-rppt@linux.ibm.com \
    --to=rppt@linux.ibm.com \
    --cc=openrisc@lists.librecores.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