1
0
Fork 0
alistair23-linux/arch/powerpc/mm
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
..
8xx_mmu.c powerpc/8xx: change name of a few page flags to avoid confusion 2018-10-14 18:04:09 +11:00
40x_mmu.c
44x_mmu.c powerpc/44x: Mark mmu_init_secondary() as __init 2018-07-30 22:48:22 +10:00
Makefile powerpc: Add -Werror at arch/powerpc level 2018-10-19 00:56:17 +11:00
copro_fault.c mm: convert return type of handle_mm_fault() caller to vm_fault_t 2018-08-17 16:20:28 -07:00
dma-noncoherent.c powerpc: handover page flags with a pgprot_t parameter 2018-10-14 18:04:09 +11:00
drmem.c powerpc/mm/drmem: Fix unexpected flag value in ibm,dynamic-memory-v2 2018-02-23 16:45:51 +11:00
dump_hashpagetable.c powerpc: remove superflous inclusions of asm/fixmap.h 2018-07-30 22:48:18 +10:00
dump_linuxpagetables-8xx.c powerpc/8xx: change name of a few page flags to avoid confusion 2018-10-14 18:04:09 +11:00
dump_linuxpagetables-book3s64.c powerpc/book3s64: fix dump_linuxpagetables "present" flag 2018-10-20 13:26:47 +11:00
dump_linuxpagetables-generic.c powerpc/mm: Split dump_pagelinuxtables flag_array table 2018-10-14 18:04:09 +11:00
dump_linuxpagetables.c powerpc/mm: Fix page table dump to work on Radix 2018-10-20 13:26:47 +11:00
dump_linuxpagetables.h powerpc/mm: Split dump_pagelinuxtables flag_array table 2018-10-14 18:04:09 +11:00
fault.c signal/powerpc: Use force_sig_fault where appropriate 2018-09-21 15:53:56 +02:00
fsl_booke_mmu.c
hash64_4k.c powerpc/mm/hash: Remove the superfluous bitwise operation when find hpte group 2018-07-24 22:03:17 +10:00
hash64_64k.c powerpc/mm/hash: Remove the superfluous bitwise operation when find hpte group 2018-07-24 22:03:17 +10:00
hash_low_32.S powerpc: clean inclusions of asm/feature-fixups.h 2018-07-30 22:48:17 +10:00
hash_native_64.c powerpc/64s/hash: Do not use PPC_INVALIDATE_ERAT on CPUs before POWER9 2018-10-04 23:16:53 +10:00
hash_utils_64.c powerpc/64s/hash: Simplify slb_flush_and_rebolt() 2018-10-14 18:04:09 +11:00
highmem.c powerpc/mm: remove warning about ‘type’ being set 2018-08-10 22:12:38 +10:00
hugepage-hash64.c arch/powerpc/mm/hash: validate the pte entries before handling the hash fault 2018-10-03 15:39:59 +10:00
hugetlbpage-book3e.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hugetlbpage-hash64.c arch/powerpc/mm/hash: validate the pte entries before handling the hash fault 2018-10-03 15:39:59 +10:00
hugetlbpage-radix.c powerpc updates for 4.15 2017-11-16 12:47:46 -08:00
hugetlbpage.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
init-common.c powerpc/mm: Fix crashes with 16G huge pages 2018-02-13 22:37:47 +11:00
init_32.c powerpc/mm/32: Remove the reserved memory hack 2018-04-01 00:47:44 +11:00
init_64.c KVM: PPC: Avoid marking DMA-mapped pages dirty in real mode 2018-09-12 08:49:54 +10:00
mem.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
mmap.c exec: pass stack rlimit into mm layout functions 2018-04-11 10:28:37 -07:00
mmu_context.c Revert "convert SLB miss handlers to C" and subsequent commits 2018-10-03 15:32:49 +10:00
mmu_context_book3s64.c powerpc/64s/hash: Add a SLB preload cache 2018-10-14 18:04:09 +11:00
mmu_context_hash32.c powerpc: remove unnecessary inclusion of asm/tlbflush.h 2018-07-30 22:48:20 +10:00
mmu_context_iommu.c KVM: PPC: Avoid marking DMA-mapped pages dirty in real mode 2018-09-12 08:49:54 +10:00
mmu_context_nohash.c memblock: stop using implicit alignment to SMP_CACHE_BYTES 2018-10-31 08:54:16 -07:00
mmu_decl.h powerpc/mm: Trace tlbia instruction 2018-10-20 13:26:47 +11:00
numa.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
pgtable-book3e.c powerpc: handover page flags with a pgprot_t parameter 2018-10-14 18:04:09 +11:00
pgtable-book3s64.c powerpc/mm: Fix WARN_ON with THP NUMA migration 2018-10-20 13:26:47 +11:00
pgtable-hash64.c powerpc: handover page flags with a pgprot_t parameter 2018-10-14 18:04:09 +11:00
pgtable-radix.c powerpc/mm/radix: Display if mappings are exec or not 2018-10-20 13:26:47 +11:00
pgtable.c powerpc/mm: Fix WARN_ON with THP NUMA migration 2018-10-20 13:26:47 +11:00
pgtable_32.c memblock: rename memblock_alloc{_nid,_try_nid} to memblock_phys_alloc* 2018-10-31 08:54:15 -07:00
pgtable_64.c powerpc/mm: use pte helpers in generic code 2018-10-14 18:04:09 +11:00
pkeys.c powerpc/pkeys: Fix reading of ibm, processor-storage-keys property 2018-09-20 22:49:46 +10:00
ppc_mmu_32.c memblock: rename memblock_alloc{_nid,_try_nid} to memblock_phys_alloc* 2018-10-31 08:54:15 -07:00
slb.c powerpc/mm: Increase the max addressable memory to 2PB 2018-10-14 18:04:09 +11:00
slice.c powerpc/mm: fix always true/false warning in slice.c 2018-10-20 13:26:47 +11:00
subpage-prot.c powerpc: remove unnecessary inclusion of asm/tlbflush.h 2018-07-30 22:48:20 +10:00
tlb-radix.c powerpc updates for 4.20 2018-10-26 14:36:21 -07:00
tlb_hash32.c powerpc/sparse: Fix plain integer as NULL pointer warning 2018-05-25 12:04:38 +10:00
tlb_hash64.c powerpc/mm: Add support for handling > 512TB address in SLB miss 2018-03-31 00:10:38 +11:00
tlb_low_64e.S powerpc: clean inclusions of asm/feature-fixups.h 2018-07-30 22:48:17 +10:00
tlb_nohash.c powerpc/nohash: fix undefined behaviour when testing page size support 2018-10-04 16:54:41 +10:00
tlb_nohash_low.S powerpc: clean inclusions of asm/feature-fixups.h 2018-07-30 22:48:17 +10:00
vphn.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vphn.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00