linux-stable/drivers
Michal Hocko c246a213f5 mm, memory_hotplug: do not assume ZONE_NORMAL is default kernel zone
Heiko Carstens has noticed that he can generate overlapping zones for
ZONE_DMA and ZONE_NORMAL:

  DMA      [mem 0x0000000000000000-0x000000007fffffff]
  Normal   [mem 0x0000000080000000-0x000000017fffffff]

  $ cat /sys/devices/system/memory/block_size_bytes
  10000000
  $ cat /sys/devices/system/memory/memory5/valid_zones
  DMA
  $ echo 0 > /sys/devices/system/memory/memory5/online
  $ cat /sys/devices/system/memory/memory5/valid_zones
  Normal
  $ echo 1 > /sys/devices/system/memory/memory5/online
  Normal

  $ cat /proc/zoneinfo
  Node 0, zone      DMA
  spanned  524288        <-----
  present  458752
  managed  455078
  start_pfn:           0 <-----

  Node 0, zone   Normal
  spanned  720896
  present  589824
  managed  571648
  start_pfn:           327680 <-----

The reason is that we assume that the default zone for kernel onlining
is ZONE_NORMAL.  This was a simplification introduced by the memory
hotplug rework and it is easily fixable by checking the range overlap in
the zone order and considering the first matching zone as the default
one.  If there is no such zone then assume ZONE_NORMAL as we have been
doing so far.

Fixes: "mm, memory_hotplug: do not associate hotadded memory to zones until online"
Link: http://lkml.kernel.org/r/20170601083746.4924-3-mhocko@kernel.org
Signed-off-by: Michal Hocko <mhocko@suse.com>
Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Tested-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Reza Arbab <arbab@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-06 16:24:32 -07:00
..
accessibility
acpi arm64 updates for 4.13: 2017-07-05 17:09:27 -07:00
amba
android
ata Merge branch 'for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2017-07-06 09:41:58 -07:00
atm net: convert sock.sk_wmem_alloc from atomic_t to refcount_t 2017-07-01 07:39:08 -07:00
auxdisplay
base mm, memory_hotplug: do not assume ZONE_NORMAL is default kernel zone 2017-07-06 16:24:32 -07:00
bcma
block zram: count same page write as page_stored 2017-07-06 16:24:31 -07:00
bluetooth Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-07-05 12:31:59 -07:00
bus ARM: SoC driver updates 2017-07-04 14:47:47 -07:00
cdrom block: don't set bounce limit in blk_init_queue 2017-06-27 12:13:45 -06:00
char arm64 updates for 4.13: 2017-07-05 17:09:27 -07:00
clk ARM: Device-tree updates 2017-07-04 14:37:25 -07:00
clocksource ARM: SoC driver updates 2017-07-04 14:47:47 -07:00
connector
cpufreq ARM: SoC driver updates 2017-07-04 14:47:47 -07:00
cpuidle Power management updates for v4.13-rc1 2017-07-04 13:39:41 -07:00
crypto Cavium CNN55XX: fix broken default Kconfig entry 2017-07-05 13:03:05 -07:00
dax
dca
devfreq
dio
dma dmaengine: omap-dma: port_window support correction for both direction 2017-06-20 11:45:01 +08:00
dma-buf
edac EDAC, pnd2: Fix Apollo Lake DIMM detection 2017-06-29 10:37:50 +02:00
eisa
extcon
firewire networking: make skb_push & __skb_push return void pointers 2017-06-16 11:48:40 -04:00
firmware arm64 updates for 4.13: 2017-07-05 17:09:27 -07:00
fmc
fpga
fsi
gpio driver core patches for 4.13-rc1 2017-07-03 20:27:48 -07:00
gpu Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-07-03 13:08:04 -07:00
hid driver core patches for 4.13-rc1 2017-07-03 20:27:48 -07:00
hsi HSI changes for the v4.13 series 2017-07-04 14:28:22 -07:00
hv
hwmon hwmon: (aspeed-pwm-tacho) Poll with short sleeps. 2017-06-24 08:58:06 -07:00
hwspinlock
hwtracing Char/Misc patches for 4.13-rc1 2017-07-03 20:55:59 -07:00
i2c Char/Misc patches for 4.13-rc1 2017-07-03 20:55:59 -07:00
ide block: Change argument type of scsi_req_init() 2017-06-20 19:27:14 -06:00
idle intel_idle: Use more common logging style 2017-06-29 22:58:35 +02:00
iio hwmon updates for v4.13: 2017-07-04 11:48:27 -07:00
infiniband Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-07-05 12:31:59 -07:00
input Input: synaptics-rmi4 - only read the F54 query registers which are used 2017-06-23 00:08:48 -07:00
iommu Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-07-03 16:50:31 -07:00
ipack
irqchip arm64 updates for 4.13: 2017-07-05 17:09:27 -07:00
isdn Merge branch 'work.misc-set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2017-07-05 13:13:32 -07:00
leds LED fixes for 4.12-rc6 2017-06-18 08:51:35 +09:00
lguest
lightnvm lightnvm: pblk: set line bitmap check under debug 2017-06-30 11:08:18 -06:00
macintosh Merge branch 'work.misc-set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2017-07-05 13:13:32 -07:00
mailbox
mcb
md Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-07-03 13:08:04 -07:00
media networking: make skb_put & friends return void pointers 2017-06-16 11:48:39 -04:00
memory ARM: SoC driver updates 2017-07-04 14:47:47 -07:00
memstick
message
mfd Merge remote-tracking branches 'regulator/topic/settle', 'regulator/topic/tps65910' and 'regulator/topic/tps65917' into regulator-next 2017-07-03 16:52:21 +01:00
misc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-07-05 12:31:59 -07:00
mmc MMC core: 2017-07-04 11:11:56 -07:00
mtd There has been a fair amount of activity in the docs tree this time 2017-07-03 21:13:25 -07:00
mux
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-07-05 12:31:59 -07:00
nfc NFC 4.13 pull request 2017-07-01 14:30:39 -07:00
ntb ntb: no sleep in ntb_async_tx_submit 2017-06-19 14:24:41 -04:00
nubus
nvdimm block: don't bother with bounce limits for make_request drivers 2017-06-27 12:13:45 -06:00
nvme Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-07-03 16:50:31 -07:00
nvmem
of Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-06-15 11:59:32 -04:00
oprofile
parisc parisc: ->mapping_error 2017-07-05 21:46:42 +02:00
parport
pci Power management updates for v4.13-rc1 2017-07-04 13:39:41 -07:00
pcmcia
perf Merge branch 'aarch64/for-next/ras-apei' into aarch64/for-next/core 2017-06-26 10:54:27 +01:00
phy phy: bcm-ns-usb3: add MDIO driver using proper bus layer 2017-06-16 13:22:26 +05:30
pinctrl Revert "pinctrl: rockchip: avoid hardirq-unsafe functions in irq_chip" 2017-06-29 15:03:24 +02:00
platform Power management updates for v4.13-rc1 2017-07-04 13:39:41 -07:00
pnp ACPI / PM: Consolidate device wakeup settings code 2017-06-28 01:52:32 +02:00
power power supply and reset changes for the v4.13 series 2017-07-04 14:25:14 -07:00
powercap powercap/RAPL: prevent overridding bits outside of the mask 2017-06-28 00:38:34 +02:00
pps
ps3
ptp ptp: Add a ptp clock driver for Broadcom DTE 2017-06-15 12:07:15 -04:00
pwm
rapidio
ras arm64 updates for 4.13: 2017-07-05 17:09:27 -07:00
regulator Merge remote-tracking branches 'regulator/topic/settle', 'regulator/topic/tps65910' and 'regulator/topic/tps65917' into regulator-next 2017-07-03 16:52:21 +01:00
remoteproc
reset ARM: SoC driver updates 2017-07-04 14:47:47 -07:00
rpmsg Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-07-05 12:31:59 -07:00
rtc sched/wait: Disambiguate wq_entry->task_list and wq_head->task_list naming 2017-06-20 12:19:14 +02:00
s390 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-07-05 12:31:59 -07:00
sbus block: don't set bounce limit in blk_init_queue 2017-06-27 12:13:45 -06:00
scsi Merge branch 'for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2017-07-06 09:41:58 -07:00
sfi
sh drivers/sh/intc/virq.c: delete an error message for a failed memory allocation in add_virq_to_pirq() 2017-07-06 16:24:30 -07:00
sn
soc ARM: SoC driver updates 2017-07-04 14:47:47 -07:00
spi Merge remote-tracking branches 'spi/topic/spidev', 'spi/topic/st-ssc4' and 'spi/topic/stm32' into spi-next 2017-07-03 16:21:12 +01:00
spmi
ssb
staging Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-07-05 12:31:59 -07:00
target Merge branch 'work.read_write' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2017-07-05 14:35:57 -07:00
tc
tee
thermal USB/PHY patches for 4.13-rc1 2017-07-03 19:30:55 -07:00
thunderbolt
tty Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-07-05 12:31:59 -07:00
uio
usb Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-07-05 12:31:59 -07:00
uwb driver core patches for 4.13-rc1 2017-07-03 20:27:48 -07:00
vfio sched/wait: Rename wait_queue_t => wait_queue_entry_t 2017-06-20 12:18:27 +02:00
vhost Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-07-05 12:31:59 -07:00
video video: fbdev: udlfb: drop log level for blanking 2017-06-14 12:40:36 +02:00
virt
virtio virtio_balloon: disable VIOMMU support 2017-06-18 23:13:35 +03:00
vlynq
vme
w1
watchdog
xen Merge branch 'ras-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-07-03 18:33:03 -07:00
zorro
Kconfig
Makefile