memblock: replace alloc_bootmem_low_pages with memblock_alloc_low
The alloc_bootmem_low_pages() function allocates PAGE_SIZE aligned regions from low memory. memblock_alloc_low() with alignment set to PAGE_SIZE does exactly the same thing. The conversion is done using the following semantic patch: @@ expression e; @@ - alloc_bootmem_low_pages(e) + memblock_alloc_low(e, PAGE_SIZE) Link: http://lkml.kernel.org/r/1536927045-23536-19-git-send-email-rppt@linux.vnet.ibm.com Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Chris Zankel <chris@zankel.net> Cc: "David S. Miller" <davem@davemloft.net> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Greentime Hu <green.hu@gmail.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Guan Xuetao <gxt@pku.edu.cn> Cc: Ingo Molnar <mingo@redhat.com> Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Cc: Jonas Bonn <jonas@southpole.se> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Ley Foon Tan <lftan@altera.com> Cc: Mark Salter <msalter@redhat.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Matt Turner <mattst88@gmail.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Michal Simek <monstr@monstr.eu> Cc: Palmer Dabbelt <palmer@sifive.com> Cc: Paul Burton <paul.burton@mips.com> Cc: Richard Kuo <rkuo@codeaurora.org> Cc: Richard Weinberger <richard@nod.at> Cc: Rich Felker <dalias@libc.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Serge Semin <fancer.lancer@gmail.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Tony Luck <tony.luck@intel.com> Cc: Vineet Gupta <vgupta@synopsys.com> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Родитель
3bb1f80ee6
Коммит
e8625dce71
|
@ -123,7 +123,7 @@ static noinline pte_t * __init alloc_kmap_pgtable(unsigned long kvaddr)
|
|||
pud_k = pud_offset(pgd_k, kvaddr);
|
||||
pmd_k = pmd_offset(pud_k, kvaddr);
|
||||
|
||||
pte_k = (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE);
|
||||
pte_k = (pte_t *)memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
|
||||
pmd_populate_kernel(&init_mm, pmd_k, pte_k);
|
||||
return pte_k;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,8 @@ void __init atari_stram_reserve_pages(void *start_mem)
|
|||
{
|
||||
if (kernel_in_stram) {
|
||||
pr_debug("atari_stram pool: kernel in ST-RAM, using alloc_bootmem!\n");
|
||||
stram_pool.start = (resource_size_t)alloc_bootmem_low_pages(pool_size);
|
||||
stram_pool.start = (resource_size_t)memblock_alloc_low(pool_size,
|
||||
PAGE_SIZE);
|
||||
stram_pool.end = stram_pool.start + pool_size - 1;
|
||||
request_resource(&iomem_resource, &stram_pool);
|
||||
stram_virt_offset = 0;
|
||||
|
|
|
@ -55,7 +55,7 @@ static pte_t * __init kernel_page_table(void)
|
|||
{
|
||||
pte_t *ptablep;
|
||||
|
||||
ptablep = (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE);
|
||||
ptablep = (pte_t *)memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
|
||||
|
||||
clear_page(ptablep);
|
||||
__flush_page_to_ram(ptablep);
|
||||
|
@ -95,7 +95,8 @@ static pmd_t * __init kernel_ptr_table(void)
|
|||
|
||||
last_pgtable += PTRS_PER_PMD;
|
||||
if (((unsigned long)last_pgtable & ~PAGE_MASK) == 0) {
|
||||
last_pgtable = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE);
|
||||
last_pgtable = (pmd_t *)memblock_alloc_low(PAGE_SIZE,
|
||||
PAGE_SIZE);
|
||||
|
||||
clear_page(last_pgtable);
|
||||
__flush_page_to_ram(last_pgtable);
|
||||
|
|
|
@ -244,7 +244,7 @@ void __init plat_swiotlb_setup(void)
|
|||
swiotlb_nslabs = ALIGN(swiotlb_nslabs, IO_TLB_SEGSIZE);
|
||||
swiotlbsize = swiotlb_nslabs << IO_TLB_SHIFT;
|
||||
|
||||
octeon_swiotlb = alloc_bootmem_low_pages(swiotlbsize);
|
||||
octeon_swiotlb = memblock_alloc_low(swiotlbsize, PAGE_SIZE);
|
||||
|
||||
if (swiotlb_init_with_tbl(octeon_swiotlb, swiotlb_nslabs, 1) == -ENOMEM)
|
||||
panic("Cannot allocate SWIOTLB buffer");
|
||||
|
|
|
@ -243,7 +243,8 @@ void __init fixrange_init(unsigned long start, unsigned long end,
|
|||
pmd = (pmd_t *)pud;
|
||||
for (; (k < PTRS_PER_PMD) && (vaddr < end); pmd++, k++) {
|
||||
if (pmd_none(*pmd)) {
|
||||
pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
|
||||
pte = (pte_t *) memblock_alloc_low(PAGE_SIZE,
|
||||
PAGE_SIZE);
|
||||
set_pmd(pmd, __pmd((unsigned long)pte));
|
||||
BUG_ON(pte != pte_offset_kernel(pmd, 0));
|
||||
}
|
||||
|
|
|
@ -64,7 +64,8 @@ void __init mem_init(void)
|
|||
static void __init one_page_table_init(pmd_t *pmd)
|
||||
{
|
||||
if (pmd_none(*pmd)) {
|
||||
pte_t *pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
|
||||
pte_t *pte = (pte_t *) memblock_alloc_low(PAGE_SIZE,
|
||||
PAGE_SIZE);
|
||||
set_pmd(pmd, __pmd(_KERNPG_TABLE +
|
||||
(unsigned long) __pa(pte)));
|
||||
if (pte != pte_offset_kernel(pmd, 0))
|
||||
|
@ -75,7 +76,7 @@ static void __init one_page_table_init(pmd_t *pmd)
|
|||
static void __init one_md_table_init(pud_t *pud)
|
||||
{
|
||||
#ifdef CONFIG_3_LEVEL_PGTABLES
|
||||
pmd_t *pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE);
|
||||
pmd_t *pmd_table = (pmd_t *) memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
|
||||
set_pud(pud, __pud(_KERNPG_TABLE + (unsigned long) __pa(pmd_table)));
|
||||
if (pmd_table != pmd_offset(pud, 0))
|
||||
BUG();
|
||||
|
@ -124,7 +125,7 @@ static void __init fixaddr_user_init( void)
|
|||
return;
|
||||
|
||||
fixrange_init( FIXADDR_USER_START, FIXADDR_USER_END, swapper_pg_dir);
|
||||
v = (unsigned long) alloc_bootmem_low_pages(size);
|
||||
v = (unsigned long) memblock_alloc_low(size, PAGE_SIZE);
|
||||
memcpy((void *) v , (void *) FIXADDR_USER_START, size);
|
||||
p = __pa(v);
|
||||
for ( ; size > 0; size -= PAGE_SIZE, vaddr += PAGE_SIZE,
|
||||
|
@ -143,7 +144,8 @@ void __init paging_init(void)
|
|||
unsigned long zones_size[MAX_NR_ZONES], vaddr;
|
||||
int i;
|
||||
|
||||
empty_zero_page = (unsigned long *) alloc_bootmem_low_pages(PAGE_SIZE);
|
||||
empty_zero_page = (unsigned long *) memblock_alloc_low(PAGE_SIZE,
|
||||
PAGE_SIZE);
|
||||
for (i = 0; i < ARRAY_SIZE(zones_size); i++)
|
||||
zones_size[i] = 0;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ static void * __init init_pmd(unsigned long vaddr, unsigned long n_pages)
|
|||
pr_debug("%s: vaddr: 0x%08lx, n_pages: %ld\n",
|
||||
__func__, vaddr, n_pages);
|
||||
|
||||
pte = alloc_bootmem_low_pages(n_pages * sizeof(pte_t));
|
||||
pte = memblock_alloc_low(n_pages * sizeof(pte_t), PAGE_SIZE);
|
||||
|
||||
for (i = 0; i < n_pages; ++i)
|
||||
pte_clear(NULL, 0, pte + i);
|
||||
|
|
Загрузка…
Ссылка в новой задаче