]> git.karo-electronics.de Git - karo-tx-linux.git/commit
sparsemem: add BUILD_BUG_ON when sizeof mem_section is non-power-of-2
authorCody P Schafer <cody@linux.vnet.ibm.com>
Fri, 7 Jun 2013 00:08:21 +0000 (10:08 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 7 Jun 2013 05:42:30 +0000 (15:42 +1000)
commit854d30ae6041606adf97d233d2076d6775240d50
treeab460d8812cc3c6fa7b413190ca37904af013d4b
parent5f9a946f21b9f526bae01517ef261e59ea37134a
sparsemem: add BUILD_BUG_ON when sizeof mem_section is non-power-of-2

Instead of leaving a hidden trap for the next person who comes along and
wants to add something to mem_section, add a big fat warning about it
needing to be a power-of-2, and insert a BUILD_BUG_ON() in sparse_init()
to catch mistakes.

Right now non-power-of-2 mem_sections cause a number of WARNs at boot
(which don't clearly point to the size of mem_section as an issue), but
the system limps on (temporarily, at least).

This is based upon Dave Hansen's earlier RFC where he ran into the same
issue:
"sparsemem: fix boot when SECTIONS_PER_ROOT is not power-of-2"
http://lkml.indiana.edu/hypermail/linux/kernel/1205.2/03077.html

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/mmzone.h
mm/sparse.c