Skip to content

Commit 7e1c4e2

Browse files
rppttorvalds
authored andcommitted
memblock: stop using implicit alignment to SMP_CACHE_BYTES
When a memblock allocation APIs are called with align = 0, the alignment is implicitly set to SMP_CACHE_BYTES. Implicit alignment is done deep in the memblock allocator and it can come as a surprise. Not that such an alignment would be wrong even when used incorrectly but it is better to be explicit for the sake of clarity and the prinicple of the least surprise. Replace all such uses of memblock APIs with the 'align' parameter explicitly set to SMP_CACHE_BYTES and stop implicit alignment assignment in the memblock internal allocation functions. For the case when memblock APIs are used via helper functions, e.g. like iommu_arena_new_node() in Alpha, the helper functions were detected with Coccinelle's help and then manually examined and updated where appropriate. The direct memblock APIs users were updated using the semantic patch below: @@ expression size, min_addr, max_addr, nid; @@ ( | - memblock_alloc_try_nid_raw(size, 0, min_addr, max_addr, nid) + memblock_alloc_try_nid_raw(size, SMP_CACHE_BYTES, min_addr, max_addr, nid) | - memblock_alloc_try_nid_nopanic(size, 0, min_addr, max_addr, nid) + memblock_alloc_try_nid_nopanic(size, SMP_CACHE_BYTES, min_addr, max_addr, nid) | - memblock_alloc_try_nid(size, 0, min_addr, max_addr, nid) + memblock_alloc_try_nid(size, SMP_CACHE_BYTES, min_addr, max_addr, nid) | - memblock_alloc(size, 0) + memblock_alloc(size, SMP_CACHE_BYTES) | - memblock_alloc_raw(size, 0) + memblock_alloc_raw(size, SMP_CACHE_BYTES) | - memblock_alloc_from(size, 0, min_addr) + memblock_alloc_from(size, SMP_CACHE_BYTES, min_addr) | - memblock_alloc_nopanic(size, 0) + memblock_alloc_nopanic(size, SMP_CACHE_BYTES) | - memblock_alloc_low(size, 0) + memblock_alloc_low(size, SMP_CACHE_BYTES) | - memblock_alloc_low_nopanic(size, 0) + memblock_alloc_low_nopanic(size, SMP_CACHE_BYTES) | - memblock_alloc_from_nopanic(size, 0, min_addr) + memblock_alloc_from_nopanic(size, SMP_CACHE_BYTES, min_addr) | - memblock_alloc_node(size, 0, nid) + memblock_alloc_node(size, SMP_CACHE_BYTES, nid) ) [mhocko@suse.com: changelog update] [akpm@linux-foundation.org: coding-style fixes] [rppt@linux.ibm.com: fix missed uses of implicit alignment] Link: http://lkml.kernel.org/r/20181016133656.GA10925@rapoport-lnx Link: http://lkml.kernel.org/r/1538687224-17535-1-git-send-email-rppt@linux.vnet.ibm.com Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Suggested-by: Michal Hocko <mhocko@suse.com> Acked-by: Paul Burton <paul.burton@mips.com> [MIPS] Acked-by: Michael Ellerman <mpe@ellerman.id.au> [powerpc] Acked-by: Michal Hocko <mhocko@suse.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Chris Zankel <chris@zankel.net> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Guan Xuetao <gxt@pku.edu.cn> Cc: Ingo Molnar <mingo@redhat.com> Cc: Matt Turner <mattst88@gmail.com> Cc: Michal Simek <monstr@monstr.eu> Cc: Richard Weinberger <richard@nod.at> Cc: Russell King <linux@armlinux.org.uk> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Tony Luck <tony.luck@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 530d4c0 commit 7e1c4e2

File tree

50 files changed

+120
-96
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+120
-96
lines changed

arch/alpha/kernel/core_apecs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ apecs_init_arch(void)
346346
* Window 1 is direct access 1GB at 1GB
347347
* Window 2 is scatter-gather 8MB at 8MB (for isa)
348348
*/
349-
hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000, 0);
349+
hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000,
350+
SMP_CACHE_BYTES);
350351
hose->sg_pci = NULL;
351352
__direct_map_base = 0x40000000;
352353
__direct_map_size = 0x40000000;

arch/alpha/kernel/core_lca.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ lca_init_arch(void)
275275
* Note that we do not try to save any of the DMA window CSRs
276276
* before setting them, since we cannot read those CSRs on LCA.
277277
*/
278-
hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000, 0);
278+
hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000,
279+
SMP_CACHE_BYTES);
279280
hose->sg_pci = NULL;
280281
__direct_map_base = 0x40000000;
281282
__direct_map_size = 0x40000000;

arch/alpha/kernel/core_marvel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ mk_resource_name(int pe, int port, char *str)
8282
char *name;
8383

8484
sprintf(tmp, "PCI %s PE %d PORT %d", str, pe, port);
85-
name = memblock_alloc(strlen(tmp) + 1, 0);
85+
name = memblock_alloc(strlen(tmp) + 1, SMP_CACHE_BYTES);
8686
strcpy(name, tmp);
8787

8888
return name;
@@ -117,7 +117,7 @@ alloc_io7(unsigned int pe)
117117
return NULL;
118118
}
119119

120-
io7 = memblock_alloc(sizeof(*io7), 0);
120+
io7 = memblock_alloc(sizeof(*io7), SMP_CACHE_BYTES);
121121
io7->pe = pe;
122122
raw_spin_lock_init(&io7->irq_lock);
123123

arch/alpha/kernel/core_mcpcia.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,11 @@ mcpcia_startup_hose(struct pci_controller *hose)
364364
* Window 1 is scatter-gather (up to) 1GB at 1GB (for pci)
365365
* Window 2 is direct access 2GB at 2GB
366366
*/
367-
hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000, 0);
367+
hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000,
368+
SMP_CACHE_BYTES);
368369
hose->sg_pci = iommu_arena_new(hose, 0x40000000,
369-
size_for_memory(0x40000000), 0);
370+
size_for_memory(0x40000000),
371+
SMP_CACHE_BYTES);
370372

371373
__direct_map_base = 0x80000000;
372374
__direct_map_size = 0x80000000;

arch/alpha/kernel/core_t2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ t2_sg_map_window2(struct pci_controller *hose,
351351

352352
/* Note we can only do 1 SG window, as the other is for direct, so
353353
do an ISA SG area, especially for the floppy. */
354-
hose->sg_isa = iommu_arena_new(hose, base, length, 0);
354+
hose->sg_isa = iommu_arena_new(hose, base, length, SMP_CACHE_BYTES);
355355
hose->sg_pci = NULL;
356356

357357
temp = (base & 0xfff00000UL) | ((base + length - 1) >> 20);

arch/alpha/kernel/core_titan.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,12 @@ titan_init_one_pachip_port(titan_pachip_port *port, int index)
316316
* Window 1 is direct access 1GB at 2GB
317317
* Window 2 is scatter-gather 1GB at 3GB
318318
*/
319-
hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000, 0);
319+
hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000,
320+
SMP_CACHE_BYTES);
320321
hose->sg_isa->align_entry = 8; /* 64KB for ISA */
321322

322-
hose->sg_pci = iommu_arena_new(hose, 0xc0000000, 0x40000000, 0);
323+
hose->sg_pci = iommu_arena_new(hose, 0xc0000000, 0x40000000,
324+
SMP_CACHE_BYTES);
323325
hose->sg_pci->align_entry = 4; /* Titan caches 4 PTEs at a time */
324326

325327
port->wsba[0].csr = hose->sg_isa->dma_base | 3;

arch/alpha/kernel/core_tsunami.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,14 @@ tsunami_init_one_pchip(tsunami_pchip *pchip, int index)
319319
* NOTE: we need the align_entry settings for Acer devices on ES40,
320320
* specifically floppy and IDE when memory is larger than 2GB.
321321
*/
322-
hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000, 0);
322+
hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000,
323+
SMP_CACHE_BYTES);
323324
/* Initially set for 4 PTEs, but will be overridden to 64K for ISA. */
324325
hose->sg_isa->align_entry = 4;
325326

326327
hose->sg_pci = iommu_arena_new(hose, 0x40000000,
327-
size_for_memory(0x40000000), 0);
328+
size_for_memory(0x40000000),
329+
SMP_CACHE_BYTES);
328330
hose->sg_pci->align_entry = 4; /* Tsunami caches 4 PTEs at a time */
329331

330332
__direct_map_base = 0x80000000;

arch/alpha/kernel/core_wildfire.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ wildfire_init_hose(int qbbno, int hoseno)
111111
* ??? We ought to scale window 3 memory.
112112
*
113113
*/
114-
hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000, 0);
115-
hose->sg_pci = iommu_arena_new(hose, 0xc0000000, 0x08000000, 0);
114+
hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000,
115+
SMP_CACHE_BYTES);
116+
hose->sg_pci = iommu_arena_new(hose, 0xc0000000, 0x08000000,
117+
SMP_CACHE_BYTES);
116118

117119
pci = WILDFIRE_pci(qbbno, hoseno);
118120

arch/alpha/kernel/pci-noop.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ alloc_pci_controller(void)
3333
{
3434
struct pci_controller *hose;
3535

36-
hose = memblock_alloc(sizeof(*hose), 0);
36+
hose = memblock_alloc(sizeof(*hose), SMP_CACHE_BYTES);
3737

3838
*hose_tail = hose;
3939
hose_tail = &hose->next;
@@ -44,7 +44,7 @@ alloc_pci_controller(void)
4444
struct resource * __init
4545
alloc_resource(void)
4646
{
47-
return memblock_alloc(sizeof(struct resource), 0);
47+
return memblock_alloc(sizeof(struct resource), SMP_CACHE_BYTES);
4848
}
4949

5050
SYSCALL_DEFINE3(pciconfig_iobase, long, which, unsigned long, bus,

arch/alpha/kernel/pci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ alloc_pci_controller(void)
392392
{
393393
struct pci_controller *hose;
394394

395-
hose = memblock_alloc(sizeof(*hose), 0);
395+
hose = memblock_alloc(sizeof(*hose), SMP_CACHE_BYTES);
396396

397397
*hose_tail = hose;
398398
hose_tail = &hose->next;
@@ -403,7 +403,7 @@ alloc_pci_controller(void)
403403
struct resource * __init
404404
alloc_resource(void)
405405
{
406-
return memblock_alloc(sizeof(struct resource), 0);
406+
return memblock_alloc(sizeof(struct resource), SMP_CACHE_BYTES);
407407
}
408408

409409

arch/alpha/kernel/pci_iommu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ iommu_arena_new_node(int nid, struct pci_controller *hose, dma_addr_t base,
7979
printk("%s: couldn't allocate arena from node %d\n"
8080
" falling back to system-wide allocation\n",
8181
__func__, nid);
82-
arena = memblock_alloc(sizeof(*arena), 0);
82+
arena = memblock_alloc(sizeof(*arena), SMP_CACHE_BYTES);
8383
}
8484

8585
arena->ptes = memblock_alloc_node(sizeof(*arena), align, nid);
@@ -92,7 +92,7 @@ iommu_arena_new_node(int nid, struct pci_controller *hose, dma_addr_t base,
9292

9393
#else /* CONFIG_DISCONTIGMEM */
9494

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

9898
#endif /* CONFIG_DISCONTIGMEM */

arch/arm/kernel/setup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,15 +856,15 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
856856
*/
857857
boot_alias_start = phys_to_idmap(start);
858858
if (arm_has_idmap_alias() && boot_alias_start != IDMAP_INVALID_ADDR) {
859-
res = memblock_alloc(sizeof(*res), 0);
859+
res = memblock_alloc(sizeof(*res), SMP_CACHE_BYTES);
860860
res->name = "System RAM (boot alias)";
861861
res->start = boot_alias_start;
862862
res->end = phys_to_idmap(end);
863863
res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
864864
request_resource(&iomem_resource, res);
865865
}
866866

867-
res = memblock_alloc(sizeof(*res), 0);
867+
res = memblock_alloc(sizeof(*res), SMP_CACHE_BYTES);
868868
res->name = "System RAM";
869869
res->start = start;
870870
res->end = end;

arch/arm/mach-omap2/omap_hwmod.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ static int __init _setup_clkctrl_provider(struct device_node *np)
726726
u64 size;
727727
int i;
728728

729-
provider = memblock_alloc(sizeof(*provider), 0);
729+
provider = memblock_alloc(sizeof(*provider), SMP_CACHE_BYTES);
730730
if (!provider)
731731
return -ENOMEM;
732732

@@ -736,12 +736,14 @@ static int __init _setup_clkctrl_provider(struct device_node *np)
736736
of_property_count_elems_of_size(np, "reg", sizeof(u32)) / 2;
737737

738738
provider->addr =
739-
memblock_alloc(sizeof(void *) * provider->num_addrs, 0);
739+
memblock_alloc(sizeof(void *) * provider->num_addrs,
740+
SMP_CACHE_BYTES);
740741
if (!provider->addr)
741742
return -ENOMEM;
742743

743744
provider->size =
744-
memblock_alloc(sizeof(u32) * provider->num_addrs, 0);
745+
memblock_alloc(sizeof(u32) * provider->num_addrs,
746+
SMP_CACHE_BYTES);
745747
if (!provider->size)
746748
return -ENOMEM;
747749

arch/arm64/kernel/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static void __init request_standard_resources(void)
218218
num_standard_resources = memblock.memory.cnt;
219219
standard_resources = memblock_alloc_low(num_standard_resources *
220220
sizeof(*standard_resources),
221-
0);
221+
SMP_CACHE_BYTES);
222222

223223
for_each_memblock(memory, region) {
224224
res = &standard_resources[i++];

arch/ia64/kernel/mca.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,9 @@ static ia64_state_log_t ia64_state_log[IA64_MAX_LOG_TYPES];
361361

362362
#define IA64_LOG_ALLOCATE(it, size) \
363363
{ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = \
364-
(ia64_err_rec_t *)memblock_alloc(size, 0); \
364+
(ia64_err_rec_t *)memblock_alloc(size, SMP_CACHE_BYTES); \
365365
ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] = \
366-
(ia64_err_rec_t *)memblock_alloc(size, 0);}
366+
(ia64_err_rec_t *)memblock_alloc(size, SMP_CACHE_BYTES);}
367367
#define IA64_LOG_LOCK_INIT(it) spin_lock_init(&ia64_state_log[it].isl_lock)
368368
#define IA64_LOG_LOCK(it) spin_lock_irqsave(&ia64_state_log[it].isl_lock, s)
369369
#define IA64_LOG_UNLOCK(it) spin_unlock_irqrestore(&ia64_state_log[it].isl_lock,s)

arch/ia64/mm/tlb.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ struct ia64_tr_entry *ia64_idtrs[NR_CPUS];
5959
void __init
6060
mmu_context_init (void)
6161
{
62-
ia64_ctx.bitmap = memblock_alloc((ia64_ctx.max_ctx + 1) >> 3, 0);
63-
ia64_ctx.flushmap = memblock_alloc((ia64_ctx.max_ctx + 1) >> 3, 0);
62+
ia64_ctx.bitmap = memblock_alloc((ia64_ctx.max_ctx + 1) >> 3,
63+
SMP_CACHE_BYTES);
64+
ia64_ctx.flushmap = memblock_alloc((ia64_ctx.max_ctx + 1) >> 3,
65+
SMP_CACHE_BYTES);
6466
}
6567

6668
/*

arch/ia64/sn/kernel/io_common.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,9 @@ void __init hubdev_init_node(nodepda_t * npda, cnodeid_t node)
391391
if (node >= num_online_nodes()) /* Headless/memless IO nodes */
392392
node = 0;
393393

394-
hubdev_info = (struct hubdev_info *)memblock_alloc_node(size, 0, node);
394+
hubdev_info = (struct hubdev_info *)memblock_alloc_node(size,
395+
SMP_CACHE_BYTES,
396+
node);
395397

396398
npda->pdinfo = (void *)hubdev_info;
397399
}

arch/ia64/sn/kernel/setup.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,8 @@ static void __init sn_init_pdas(char **cmdline_p)
511511
*/
512512
for_each_online_node(cnode) {
513513
nodepdaindr[cnode] =
514-
memblock_alloc_node(sizeof(nodepda_t), 0, cnode);
514+
memblock_alloc_node(sizeof(nodepda_t), SMP_CACHE_BYTES,
515+
cnode);
515516
memset(nodepdaindr[cnode]->phys_cpuid, -1,
516517
sizeof(nodepdaindr[cnode]->phys_cpuid));
517518
spin_lock_init(&nodepdaindr[cnode]->ptc_lock);
@@ -522,7 +523,7 @@ static void __init sn_init_pdas(char **cmdline_p)
522523
*/
523524
for (cnode = num_online_nodes(); cnode < num_cnodes; cnode++)
524525
nodepdaindr[cnode] =
525-
memblock_alloc_node(sizeof(nodepda_t), 0, 0);
526+
memblock_alloc_node(sizeof(nodepda_t), SMP_CACHE_BYTES, 0);
526527

527528
/*
528529
* Now copy the array of nodepda pointers to each nodepda.

arch/m68k/sun3/sun3dvma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ void __init dvma_init(void)
268268
list_add(&(hole->list), &hole_list);
269269

270270
iommu_use = memblock_alloc(IOMMU_TOTAL_ENTRIES * sizeof(unsigned long),
271-
0);
271+
SMP_CACHE_BYTES);
272272

273273
dvma_unmap_iommu(DVMA_START, DVMA_SIZE);
274274

arch/microblaze/mm/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ void * __ref zalloc_maybe_bootmem(size_t size, gfp_t mask)
376376
if (mem_init_done)
377377
p = kzalloc(size, mask);
378378
else {
379-
p = memblock_alloc(size, 0);
379+
p = memblock_alloc(size, SMP_CACHE_BYTES);
380380
if (p)
381381
memset(p, 0, size);
382382
}

arch/mips/kernel/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ static void __init resource_init(void)
916916
if (end >= HIGHMEM_START)
917917
end = HIGHMEM_START - 1;
918918

919-
res = memblock_alloc(sizeof(struct resource), 0);
919+
res = memblock_alloc(sizeof(struct resource), SMP_CACHE_BYTES);
920920

921921
res->start = start;
922922
res->end = end;

arch/powerpc/kernel/paca.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ void __init allocate_paca_ptrs(void)
198198
paca_nr_cpu_ids = nr_cpu_ids;
199199

200200
paca_ptrs_size = sizeof(struct paca_struct *) * nr_cpu_ids;
201-
paca_ptrs = __va(memblock_phys_alloc(paca_ptrs_size, 0));
201+
paca_ptrs = __va(memblock_phys_alloc(paca_ptrs_size, SMP_CACHE_BYTES));
202202
memset(paca_ptrs, 0x88, paca_ptrs_size);
203203
}
204204

arch/powerpc/kernel/pci_32.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ pci_create_OF_bus_map(void)
203203
struct property* of_prop;
204204
struct device_node *dn;
205205

206-
of_prop = memblock_alloc(sizeof(struct property) + 256, 0);
206+
of_prop = memblock_alloc(sizeof(struct property) + 256,
207+
SMP_CACHE_BYTES);
207208
dn = of_find_node_by_path("/");
208209
if (dn) {
209210
memset(of_prop, -1, sizeof(struct property) + 256);

arch/powerpc/lib/alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void * __ref zalloc_maybe_bootmem(size_t size, gfp_t mask)
1414
if (slab_is_available())
1515
p = kzalloc(size, mask);
1616
else {
17-
p = memblock_alloc(size, 0);
17+
p = memblock_alloc(size, SMP_CACHE_BYTES);
1818
}
1919
return p;
2020
}

arch/powerpc/mm/mmu_context_nohash.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,11 @@ void __init mmu_context_init(void)
461461
/*
462462
* Allocate the maps used by context management
463463
*/
464-
context_map = memblock_alloc(CTX_MAP_SIZE, 0);
465-
context_mm = memblock_alloc(sizeof(void *) * (LAST_CONTEXT + 1), 0);
464+
context_map = memblock_alloc(CTX_MAP_SIZE, SMP_CACHE_BYTES);
465+
context_mm = memblock_alloc(sizeof(void *) * (LAST_CONTEXT + 1),
466+
SMP_CACHE_BYTES);
466467
#ifdef CONFIG_SMP
467-
stale_map[boot_cpuid] = memblock_alloc(CTX_MAP_SIZE, 0);
468+
stale_map[boot_cpuid] = memblock_alloc(CTX_MAP_SIZE, SMP_CACHE_BYTES);
468469

469470
cpuhp_setup_state_nocalls(CPUHP_POWERPC_MMU_CTX_PREPARE,
470471
"powerpc/mmu/ctx:prepare",

arch/powerpc/platforms/powermac/nvram.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ static int __init core99_nvram_setup(struct device_node *dp, unsigned long addr)
513513
printk(KERN_ERR "nvram: no address\n");
514514
return -EINVAL;
515515
}
516-
nvram_image = memblock_alloc(NVRAM_SIZE, 0);
516+
nvram_image = memblock_alloc(NVRAM_SIZE, SMP_CACHE_BYTES);
517517
nvram_data = ioremap(addr, NVRAM_SIZE*2);
518518
nvram_naddrs = 1; /* Make sure we get the correct case */
519519

arch/powerpc/platforms/powernv/pci-ioda.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3769,7 +3769,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
37693769
phb_id = be64_to_cpup(prop64);
37703770
pr_debug(" PHB-ID : 0x%016llx\n", phb_id);
37713771

3772-
phb = memblock_alloc(sizeof(*phb), 0);
3772+
phb = memblock_alloc(sizeof(*phb), SMP_CACHE_BYTES);
37733773

37743774
/* Allocate PCI controller */
37753775
phb->hose = hose = pcibios_alloc_controller(np);
@@ -3815,7 +3815,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
38153815
else
38163816
phb->diag_data_size = PNV_PCI_DIAG_BUF_SIZE;
38173817

3818-
phb->diag_data = memblock_alloc(phb->diag_data_size, 0);
3818+
phb->diag_data = memblock_alloc(phb->diag_data_size, SMP_CACHE_BYTES);
38193819

38203820
/* Parse 32-bit and IO ranges (if any) */
38213821
pci_process_bridge_OF_ranges(hose, np, !hose->global_number);
@@ -3874,7 +3874,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
38743874
}
38753875
pemap_off = size;
38763876
size += phb->ioda.total_pe_num * sizeof(struct pnv_ioda_pe);
3877-
aux = memblock_alloc(size, 0);
3877+
aux = memblock_alloc(size, SMP_CACHE_BYTES);
38783878
phb->ioda.pe_alloc = aux;
38793879
phb->ioda.m64_segmap = aux + m64map_off;
38803880
phb->ioda.m32_segmap = aux + m32map_off;

arch/powerpc/sysdev/msi_bitmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ int __ref msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count,
128128
if (bmp->bitmap_from_slab)
129129
bmp->bitmap = kzalloc(size, GFP_KERNEL);
130130
else {
131-
bmp->bitmap = memblock_alloc(size, 0);
131+
bmp->bitmap = memblock_alloc(size, SMP_CACHE_BYTES);
132132
/* the bitmap won't be freed from memblock allocator */
133133
kmemleak_not_leak(bmp->bitmap);
134134
}

arch/um/drivers/net_kern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ static int __init eth_setup(char *str)
650650
return 1;
651651
}
652652

653-
new = memblock_alloc(sizeof(*new), 0);
653+
new = memblock_alloc(sizeof(*new), SMP_CACHE_BYTES);
654654

655655
INIT_LIST_HEAD(&new->list);
656656
new->index = n;

0 commit comments

Comments
 (0)