1
0
Fork 0
alistair23-linux/arch/mips
Mike Rapoport 7e1c4e2792 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>
2018-10-31 08:54:16 -07:00
..
alchemy mtd: rawnand: Move platform_nand_xxx definitions out of rawnand.h 2018-10-03 11:12:25 +02:00
ar7 mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
ath25 mips: unify prom_putchar() declarations 2018-07-17 09:40:17 -07:00
ath79 mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
bcm47xx MIPS: BCM47XX: Enable USB power on Netgear WNDR3400v3 2018-08-29 11:11:00 -07:00
bcm63xx mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
bmips mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
boot Here are the main MIPS updates for 4.20: 2018-10-26 14:43:48 -07:00
cavium-octeon mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
cobalt
configs MIPS: generic: Add Network, SPI and I2C to ocelot_defconfig 2018-10-15 23:11:15 -07:00
crypto MIPS: crypto: Add crc32 and crc32c hw accelerated module 2018-02-19 20:50:36 +00:00
dec mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
emma mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
fw mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
generic MIPS: mscc: add PCB120 to the ocelot fitImage 2018-10-09 10:38:29 -07:00
include treewide: remove current_text_addr 2018-10-31 08:54:12 -07:00
jazz mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
jz4740 JFFS2 changes: 2018-08-14 10:57:44 -07:00
kernel memblock: stop using implicit alignment to SMP_CACHE_BYTES 2018-10-31 08:54:16 -07:00
kvm mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
lantiq mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
lasat mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
lib MIPS: lib: Use kernel_pref & user_pref in memcpy() 2018-10-15 23:11:14 -07:00
loongson32 MIPS: Loongson: Merge load addresses 2018-07-30 18:59:01 -07:00
loongson64 mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
math-emu MIPS: math-emu: Mark fall throughs in switch statements with a comment 2017-12-12 17:20:20 +01:00
mm mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
mti-malta mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
net bpf, mips: remove unused function 2018-05-14 19:11:45 -07:00
netlogic mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
oprofile MIPS: perf: More robustly probe for the presence of per-tc counters 2018-05-15 15:16:16 +01:00
paravirt mips: unify prom_putchar() declarations 2018-07-17 09:40:17 -07:00
pci mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
pic32 mips: unify prom_putchar() declarations 2018-07-17 09:40:17 -07:00
pistachio License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pmcs-msp71xx MIPS: Remove no-op/identity casts 2018-08-31 11:49:20 -07:00
pnx833x mtd: rawnand: Move platform_nand_xxx definitions out of rawnand.h 2018-10-03 11:12:25 +02:00
power License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ralink mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
rb532 mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
sgi-ip22 MIPS: Remove no-op/identity casts 2018-08-31 11:49:20 -07:00
sgi-ip27 mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
sgi-ip32 MIPS: IP32: use generic dma noncoherent ops 2018-06-24 09:27:27 -07:00
sibyte mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
sni MIPS: sni: Remove the read_persistent_clock() 2018-05-14 23:58:25 +01:00
tools MIPS: Use a custom elf-entry program to find kernel entry point 2018-08-30 09:39:22 -07:00
txx9 mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
vdso MIPS: VDSO: Force link endianness 2018-08-07 16:16:13 -07:00
vr41xx MIPS: Annotate cpu_wait implementations with __cpuidle 2018-06-28 14:18:54 -07:00
Kbuild MIPS: Disable Werror when W= is set 2017-04-10 11:56:07 +02:00
Kbuild.platforms MIPS: Xilfpga: Switch to using generic defconfigs 2017-11-08 22:54:14 +00:00
Kconfig mm: remove CONFIG_HAVE_MEMBLOCK 2018-10-31 08:54:15 -07:00
Kconfig.debug Kconfig: consolidate the "Kernel hacking" menu 2018-08-02 08:06:48 +09:00
Makefile Here are the main MIPS updates for 4.20: 2018-10-26 14:43:48 -07:00
Makefile.postlink License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00