WSL2-Linux-Kernel/arch/arm/kernel
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
..
.gitignore
Makefile ARM: bugs: prepare processor bug infrastructure 2018-05-31 10:39:18 +01:00
arch_timer.c
armksyms.c ARM: 8788/1: ftrace: remove old mcount support 2018-09-19 10:44:50 +01:00
asm-offsets.c include/linux/compiler*.h: make compiler-*.h mutually exclusive 2018-08-22 17:31:34 -07:00
atags.h
atags_compat.c
atags_parse.c
atags_proc.c
bios32.c
bugs.c ARM: bugs: add support for per-processor bug checking 2018-05-31 10:39:34 +01:00
cpuidle.c
crash_dump.c
debug.S
devtree.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
dma-isa.c
dma.c proc: introduce proc_create_single{,_data} 2018-05-16 07:23:35 +02:00
early_printk.c
efi.c
elf.c
entry-armv.S ARM: Convert to GENERIC_IRQ_MULTI_HANDLER 2018-08-03 12:14:08 +02:00
entry-common.S ARM: 8802/1: Call syscall_trace_exit even when system call skipped 2018-10-10 13:53:12 +01:00
entry-ftrace.S ARM: 8788/1: ftrace: remove old mcount support 2018-09-19 10:44:50 +01:00
entry-header.S ARM: spectre-v1: fix syscall entry 2018-05-31 23:27:26 +01:00
entry-v7m.S
fiq.c
fiqasm.S
ftrace.c ARM: 8788/1: ftrace: remove old mcount support 2018-09-19 10:44:50 +01:00
head-common.S ARM: 8745/1: get rid of __memzero() 2018-01-21 15:37:56 +00:00
head-inflate-data.c
head-nommu.S Merge branches 'fixes', 'misc' and 'spectre' into for-linus 2018-08-13 16:28:50 +01:00
head.S
hibernate.c
hw_breakpoint.c perf/arch/arm: Implement hw_breakpoint_arch_parse() 2018-06-26 09:07:56 +02:00
hyp-stub.S
insn.c
io.c
irq.c ARM: Convert to GENERIC_IRQ_MULTI_HANDLER 2018-08-03 12:14:08 +02:00
isa.c
iwmmxt.S
jump_label.c
kgdb.c
machine_kexec.c ARM: kexec: record parent context registers for non-crash CPUs 2018-05-19 11:35:56 +01:00
module-plts.c
module.c
module.lds
opcodes.c
paravirt.c x86/paravirt: Use a single ops structure 2018-09-03 16:50:35 +02:00
patch.c
perf_callchain.c
perf_event_v6.c arm_pmu: Tidy up clear_event_idx call backs 2018-07-10 18:19:02 +01:00
perf_event_v7.c arm_pmu: Tidy up clear_event_idx call backs 2018-07-10 18:19:02 +01:00
perf_event_xscale.c arm_pmu: Tidy up clear_event_idx call backs 2018-07-10 18:19:02 +01:00
perf_regs.c
pj4-cp0.c
process.c mm: zero out the vma in vma_init() 2018-08-22 10:52:44 -07:00
psci_smp.c
ptrace.c signal/arm: Use force_sig_fault where appropriate 2018-09-27 21:57:39 +02:00
reboot.c
reboot.h
relocate_kernel.S
return_address.c
setup.c memblock: stop using implicit alignment to SMP_CACHE_BYTES 2018-10-31 08:54:16 -07:00
signal.c Merge branches 'fixes', 'misc' and 'spectre' into for-next 2018-10-10 13:53:33 +01:00
signal.h
sigreturn_codes.S
sleep.S
smccc-call.S
smp.c Merge branches 'fixes', 'misc' and 'spectre' into for-linus 2018-06-05 10:03:27 +01:00
smp_scu.c
smp_tlb.c
smp_twd.c
stacktrace.c
suspend.c ARM: bugs: hook processor bug checking into SMP and suspend paths 2018-05-31 10:39:29 +01:00
swp_emulate.c signal/arm: Push siginfo generation into arm_notify_die 2018-09-27 21:55:30 +02:00
sys_arm.c mm: add ksys_fadvise64_64() helper; remove in-kernel call to sys_fadvise64_64() 2018-04-02 20:16:10 +02:00
sys_oabi-compat.c Merge branches 'fixes', 'misc' and 'spectre' into for-next 2018-10-10 13:53:33 +01:00
tcm.c
thumbee.c
time.c ARM/time: Remove read_boot_clock64() 2018-07-20 00:02:41 +02:00
topology.c ARM: topology: remove unneeded check for /cpus node 2018-09-28 14:25:58 -05:00
traps.c signal/arm: Push siginfo generation into arm_notify_die 2018-09-27 21:55:30 +02:00
unwind.c
v7m.c
vdso.c ARM: 8748/1: mm: Define vdso_start, vdso_end as array 2018-03-24 14:27:49 +00:00
vmlinux-xip.lds.S vmlinux.lds.h: Move LSM_TABLE into INIT_DATA 2018-10-10 20:40:21 -07:00
vmlinux.lds.S ARM: 8757/1: NOMMU: Support PMSAv8 MPU 2018-05-19 11:53:46 +01:00
vmlinux.lds.h vmlinux.lds.h: Fix incomplete .text.exit discards 2018-10-12 08:54:58 +11:00
xscale-cp0.c