1
0
Fork 0
alistair23-linux/arch/um/drivers
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
..
Kconfig um: create a proper drivers Kconfig 2018-08-02 08:03:23 +09:00
Makefile kbuild: change ld_flags to contain LDFLAGS_$(@F) 2018-07-19 08:40:27 +09:00
chan.h um: Use tty_port in SIGWINCH handler 2013-03-11 10:08:04 +01:00
chan_kern.c Epoll based IRQ controller 2018-02-19 19:38:51 +01:00
chan_user.c um: Use tty_port in SIGWINCH handler 2013-03-11 10:08:04 +01:00
chan_user.h um: Use tty_port in SIGWINCH handler 2013-03-11 10:08:04 +01:00
cow.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cow_sys.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cow_user.c um: switch cow_user.h to htobe{32,64}/betoh{32,64} 2012-04-10 00:13:45 +02:00
daemon.h um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
daemon_kern.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
daemon_user.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
fd.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
harddog_kern.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
harddog_user.c um: Do not use stdin and stdout identifiers for struct members 2015-06-25 22:42:19 +02:00
hostaudio_kern.c um: annotate ->poll() instances 2017-11-27 16:19:59 -05:00
line.c Epoll based IRQ controller 2018-02-19 19:38:51 +01:00
line.h um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
mconsole.h um: Stop abusing __KERNEL__ 2015-05-31 22:05:32 +02:00
mconsole_kern.c mconsole_proc(): don't mess with file->f_pos 2018-02-09 19:28:01 -08:00
mconsole_kern.h um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
mconsole_user.c um: -include user.h for USER_OBJ, trim includes 2011-11-02 14:14:44 +01:00
mmapper_kern.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
net_kern.c memblock: stop using implicit alignment to SMP_CACHE_BYTES 2018-10-31 08:54:16 -07:00
net_user.c um: fix returns without va_end 2015-12-08 22:26:00 +01:00
null.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
pcap_kern.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
pcap_user.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
pcap_user.h um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
port.h uml: remove useless comments 2009-04-01 08:59:17 -07:00
port_kern.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
port_user.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
pty.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
random.c Epoll based IRQ controller 2018-02-19 19:38:51 +01:00
slip.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
slip_common.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
slip_common.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
slip_kern.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
slip_user.c um: Do not use stdin and stdout identifiers for struct members 2015-06-25 22:42:19 +02:00
slirp.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
slirp_kern.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
slirp_user.c um: Do not use stdin and stdout identifiers for struct members 2015-06-25 22:42:19 +02:00
ssl.c um: Use tty_port_operations->destruct 2013-03-11 10:08:03 +01:00
ssl.h uml: remove useless comments 2009-04-01 08:59:17 -07:00
stderr_console.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
stdio_console.c um: console: Ignore console= option 2017-07-05 23:18:48 +02:00
stdio_console.h uml: remove useless comments 2009-04-01 08:59:17 -07:00
tty.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
ubd.h um: UBD Improvements 2016-12-14 22:46:55 +01:00
ubd_kern.c ubd: remove use of blk_rq_map_sg 2018-10-18 15:13:12 -06:00
ubd_user.c um: UBD Improvements 2016-12-14 22:46:55 +01:00
umcast.h um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
umcast_kern.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
umcast_user.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
vde.h uml: add VDE networking support 2007-10-16 09:43:05 -07:00
vde_kern.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
vde_user.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
vector_kern.c memblock: stop using implicit alignment to SMP_CACHE_BYTES 2018-10-31 08:54:16 -07:00
vector_kern.h Fix vector raw inintialization logic 2018-03-29 22:18:02 +02:00
vector_transports.c net: in virtio_net_hdr only add VLAN_HLEN to csum_start if payload holds vlan 2018-06-07 16:15:38 -04:00
vector_user.c Fix vector raw inintialization logic 2018-03-29 22:18:02 +02:00
vector_user.h Fix vector raw inintialization logic 2018-03-29 22:18:02 +02:00
xterm.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
xterm.h uml: remove useless comments 2009-04-01 08:59:17 -07:00
xterm_kern.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00