aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Rapoport <rppt@linux.vnet.ibm.com>2018-10-17 11:18:30 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2018-10-19 17:25:08 +1100
commit668d2401eccca9b00edf2880ca9b176f6f974c0c (patch)
treedcc613ebf4884cd848e8972f1da22f4c0d760df3
parentc38b67f8ed15cdaa061debee9893b89407c88e89 (diff)
download96b-common-668d2401eccca9b00edf2880ca9b176f6f974c0c.tar.gz
mm/memblock.c: warn if zero alignment was requested
After updating all memblock users to explicitly specify SMP_CACHE_BYTES alignment rather than use 0, it is still possible that uncovered users may sneak in. Add a WARN_ON_ONCE for such cases. Link: http://lkml.kernel.org/r/20181011060850.GA19822@rapoport-lnx Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Michal Hocko <mhocko@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
-rw-r--r--mm/memblock.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index 0bbae56a5e8c..5fefc70253ee 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1298,6 +1298,9 @@ static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size,
{
phys_addr_t found;
+ if (WARN_ON_ONCE(!align))
+ align = SMP_CACHE_BYTES;
+
found = memblock_find_in_range_node(size, align, start, end, nid,
flags);
if (found && !memblock_reserve(found, size)) {
@@ -1420,6 +1423,9 @@ static void * __init memblock_alloc_internal(
if (WARN_ON_ONCE(slab_is_available()))
return kzalloc_node(size, GFP_NOWAIT, nid);
+ if (WARN_ON_ONCE(!align))
+ align = SMP_CACHE_BYTES;
+
if (max_addr > memblock.current_limit)
max_addr = memblock.current_limit;
again: