Skip to content

Commit

Permalink
arch: use memblock_alloc() instead of memblock_alloc_from(size, align…
Browse files Browse the repository at this point in the history
…, 0)

The last parameter of memblock_alloc_from() is the lower limit for the
memory allocation.  When it is 0, the call is equivalent to
memblock_alloc().

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Mike Rapoport <[email protected]>
Acked-by: Paul Burton <[email protected]> # MIPS part
Cc: Catalin Marinas <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Dennis Zhou <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Greentime Hu <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Guo Ren <[email protected]>
Cc: Guo Ren <[email protected]>				[c-sky]
Cc: Heiko Carstens <[email protected]>
Cc: Juergen Gross <[email protected]>			[Xen]
Cc: Mark Salter <[email protected]>
Cc: Matt Turner <[email protected]>
Cc: Max Filippov <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Petr Mladek <[email protected]>
Cc: Richard Weinberger <[email protected]>
Cc: Rich Felker <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Russell King <[email protected]>
Cc: Stafford Horne <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Vineet Gupta <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
rppt authored and torvalds committed Mar 12, 2019
1 parent c366ea8 commit 9415673
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion arch/alpha/kernel/core_cia.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ cia_prepare_tbia_workaround(int window)
long i;

/* Use minimal 1K map. */
ppte = memblock_alloc_from(CIA_BROKEN_TBIA_SIZE, 32768, 0);
ppte = memblock_alloc(CIA_BROKEN_TBIA_SIZE, 32768);
pte = (virt_to_phys(ppte) >> (PAGE_SHIFT - 1)) | 1;

for (i = 0; i < CIA_BROKEN_TBIA_SIZE / sizeof(unsigned long); ++i)
Expand Down
4 changes: 2 additions & 2 deletions arch/alpha/kernel/pci_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ iommu_arena_new_node(int nid, struct pci_controller *hose, dma_addr_t base,
printk("%s: couldn't allocate arena ptes from node %d\n"
" falling back to system-wide allocation\n",
__func__, nid);
arena->ptes = memblock_alloc_from(mem_size, align, 0);
arena->ptes = memblock_alloc(mem_size, align);
}

#else /* CONFIG_DISCONTIGMEM */

arena = memblock_alloc(sizeof(*arena), SMP_CACHE_BYTES);
arena->ptes = memblock_alloc_from(mem_size, align, 0);
arena->ptes = memblock_alloc(mem_size, align);

#endif /* CONFIG_DISCONTIGMEM */

Expand Down
2 changes: 1 addition & 1 deletion arch/alpha/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ move_initrd(unsigned long mem_limit)
unsigned long size;

size = initrd_end - initrd_start;
start = memblock_alloc_from(PAGE_ALIGN(size), PAGE_SIZE, 0);
start = memblock_alloc(PAGE_ALIGN(size), PAGE_SIZE);
if (!start || __pa(start) + size > mem_limit) {
initrd_start = initrd_end = 0;
return NULL;
Expand Down
3 changes: 1 addition & 2 deletions arch/ia64/kernel/mca.c
Original file line number Diff line number Diff line change
Expand Up @@ -1835,8 +1835,7 @@ format_mca_init_stack(void *mca_data, unsigned long offset,
/* Caller prevents this from being called after init */
static void * __ref mca_bootmem(void)
{
return memblock_alloc_from(sizeof(struct ia64_mca_cpu),
KERNEL_STACK_SIZE, 0);
return memblock_alloc(sizeof(struct ia64_mca_cpu), KERNEL_STACK_SIZE);
}

/* Do per-CPU MCA-related initialization. */
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -2293,7 +2293,7 @@ void __init trap_init(void)
phys_addr_t ebase_pa;

ebase = (unsigned long)
memblock_alloc_from(size, 1 << fls(size), 0);
memblock_alloc(size, 1 << fls(size));

/*
* Try to ensure ebase resides in KSeg0 if possible.
Expand Down
2 changes: 1 addition & 1 deletion arch/sparc/kernel/prom_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void * __init prom_early_alloc(unsigned long size)
{
void *ret;

ret = memblock_alloc_from(size, SMP_CACHE_BYTES, 0UL);
ret = memblock_alloc(size, SMP_CACHE_BYTES);
if (ret != NULL)
memset(ret, 0, size);

Expand Down
2 changes: 1 addition & 1 deletion arch/sparc/mm/init_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void __init mem_init(void)
i = last_valid_pfn >> ((20 - PAGE_SHIFT) + 5);
i += 1;
sparc_valid_addr_bitmap = (unsigned long *)
memblock_alloc_from(i << 2, SMP_CACHE_BYTES, 0UL);
memblock_alloc(i << 2, SMP_CACHE_BYTES);

if (sparc_valid_addr_bitmap == NULL) {
prom_printf("mem_init: Cannot alloc valid_addr_bitmap.\n");
Expand Down
10 changes: 5 additions & 5 deletions arch/sparc/mm/srmmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,13 @@ static void __init srmmu_nocache_init(void)

bitmap_bits = srmmu_nocache_size >> SRMMU_NOCACHE_BITMAP_SHIFT;

srmmu_nocache_pool = memblock_alloc_from(srmmu_nocache_size,
SRMMU_NOCACHE_ALIGN_MAX, 0UL);
srmmu_nocache_pool = memblock_alloc(srmmu_nocache_size,
SRMMU_NOCACHE_ALIGN_MAX);
memset(srmmu_nocache_pool, 0, srmmu_nocache_size);

srmmu_nocache_bitmap =
memblock_alloc_from(BITS_TO_LONGS(bitmap_bits) * sizeof(long),
SMP_CACHE_BYTES, 0UL);
memblock_alloc(BITS_TO_LONGS(bitmap_bits) * sizeof(long),
SMP_CACHE_BYTES);
bit_map_init(&srmmu_nocache_map, srmmu_nocache_bitmap, bitmap_bits);

srmmu_swapper_pg_dir = __srmmu_get_nocache(SRMMU_PGD_TABLE_SIZE, SRMMU_PGD_TABLE_SIZE);
Expand Down Expand Up @@ -467,7 +467,7 @@ static void __init sparc_context_init(int numctx)
unsigned long size;

size = numctx * sizeof(struct ctx_list);
ctx_list_pool = memblock_alloc_from(size, SMP_CACHE_BYTES, 0UL);
ctx_list_pool = memblock_alloc(size, SMP_CACHE_BYTES);

for (ctx = 0; ctx < numctx; ctx++) {
struct ctx_list *clist;
Expand Down

0 comments on commit 9415673

Please sign in to comment.