Skip to content

Commit 1e8ffd5

Browse files
rppttorvalds
authored andcommitted
openrisc: simplify pte_alloc_one_kernel()
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(). Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Mike Rapoport <[email protected]> Acked-by: Stafford Horne <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Greentime Hu <[email protected]> Cc: Guan Xuetao <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Jonas Bonn <[email protected]> Cc: Mark Salter <[email protected]> Cc: Martin Schwidefsky <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Michal Simek <[email protected]> Cc: Michal Simek <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Rich Felker <[email protected]> Cc: Russell King <[email protected]> Cc: Stefan Kristiansson <[email protected]> Cc: Vincent Chen <[email protected]> Cc: Yoshinori Sato <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 47f1e92 commit 1e8ffd5

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

arch/openrisc/mm/ioremap.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,10 @@ pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm)
122122
{
123123
pte_t *pte;
124124

125-
if (likely(mem_init_done)) {
126-
pte = (pte_t *) __get_free_page(GFP_KERNEL);
127-
} else {
128-
pte = (pte_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
129-
}
125+
if (likely(mem_init_done))
126+
pte = (pte_t *)get_zeroed_page(GFP_KERNEL);
127+
else
128+
pte = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
130129

131-
if (pte)
132-
clear_page(pte);
133130
return pte;
134131
}

0 commit comments

Comments
 (0)