]> Git Repo - linux.git/commit - drivers/firmware/efi/memmap.c
memblock: stop using implicit alignment to SMP_CACHE_BYTES
authorMike Rapoport <[email protected]>
Tue, 30 Oct 2018 22:09:57 +0000 (15:09 -0700)
committerLinus Torvalds <[email protected]>
Wed, 31 Oct 2018 15:54:16 +0000 (08:54 -0700)
commit7e1c4e27928e5f87b9b1eaf06dc31773b2f1e7f1
treed1fa2f4ef8d5e2c15c2db4b80f5782ca3d26db83
parent530d4c0cfd5b71caf2d17f73a80696c4a4509813
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)
)

[[email protected]: changelog update]
[[email protected]: coding-style fixes]
[[email protected]: fix missed uses of implicit alignment]
Link: http://lkml.kernel.org/r/20181016133656.GA10925@rapoport-lnx
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Mike Rapoport <[email protected]>
Suggested-by: Michal Hocko <[email protected]>
Acked-by: Paul Burton <[email protected]> [MIPS]
Acked-by: Michael Ellerman <[email protected]> [powerpc]
Acked-by: Michal Hocko <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Chris Zankel <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Matt Turner <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Richard Weinberger <[email protected]>
Cc: Russell King <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Tony Luck <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
50 files changed:
arch/alpha/kernel/core_apecs.c
arch/alpha/kernel/core_lca.c
arch/alpha/kernel/core_marvel.c
arch/alpha/kernel/core_mcpcia.c
arch/alpha/kernel/core_t2.c
arch/alpha/kernel/core_titan.c
arch/alpha/kernel/core_tsunami.c
arch/alpha/kernel/core_wildfire.c
arch/alpha/kernel/pci-noop.c
arch/alpha/kernel/pci.c
arch/alpha/kernel/pci_iommu.c
arch/arm/kernel/setup.c
arch/arm/mach-omap2/omap_hwmod.c
arch/arm64/kernel/setup.c
arch/ia64/kernel/mca.c
arch/ia64/mm/tlb.c
arch/ia64/sn/kernel/io_common.c
arch/ia64/sn/kernel/setup.c
arch/m68k/sun3/sun3dvma.c
arch/microblaze/mm/init.c
arch/mips/kernel/setup.c
arch/powerpc/kernel/paca.c
arch/powerpc/kernel/pci_32.c
arch/powerpc/lib/alloc.c
arch/powerpc/mm/mmu_context_nohash.c
arch/powerpc/platforms/powermac/nvram.c
arch/powerpc/platforms/powernv/pci-ioda.c
arch/powerpc/sysdev/msi_bitmap.c
arch/um/drivers/net_kern.c
arch/um/drivers/vector_kern.c
arch/um/kernel/initrd.c
arch/unicore32/kernel/setup.c
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/apic/io_apic.c
arch/x86/kernel/e820.c
arch/x86/platform/olpc/olpc_dt.c
arch/xtensa/platforms/iss/network.c
drivers/clk/ti/clk.c
drivers/firmware/efi/memmap.c
drivers/firmware/memmap.c
drivers/macintosh/smu.c
drivers/of/of_reserved_mem.c
include/linux/memblock.h
init/main.c
kernel/power/snapshot.c
lib/cpumask.c
mm/memblock.c
mm/page_alloc.c
mm/percpu.c
mm/sparse.c
This page took 0.080454 seconds and 4 git commands to generate.