From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Tang Chen <tangchen@cn.fujitsu.com>,
Xishi Qiu <qiuxishi@huawei.com>,
Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>,
Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Taku Izumi <izumi.taku@jp.fujitsu.com>,
Gu Zheng <guz.fnst@cn.fujitsu.com>,
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
Vlastimil Babka <vbabka@suse.cz>,
Mel Gorman <mgorman@techsingularity.net>,
David Rientjes <rientjes@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 4.2 119/120] memory-hotplug: add hot-added memory ranges to memblock before allocate node_data for a node.
Date: Sat, 19 Sep 2015 10:29:19 -0700 [thread overview]
Message-ID: <20150919171733.048014175@linuxfoundation.org> (raw)
In-Reply-To: <20150919171712.735441938@linuxfoundation.org>
4.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tang Chen <tangchen@cn.fujitsu.com>
commit 7f36e3e56db1ae75d1e157011b3cb2e0957f0a7e upstream.
Commit f9126ab9241f ("memory-hotplug: fix wrong edge when hot add a new
node") hot-added memory range to memblock, after creating pgdat for new
node.
But there is a problem:
add_memory()
|--> hotadd_new_pgdat()
|--> free_area_init_node()
|--> get_pfn_range_for_nid()
|--> find start_pfn and end_pfn in memblock
|--> ......
|--> memblock_add_node(start, size, nid) -------- Here, just too late.
get_pfn_range_for_nid() will find that start_pfn and end_pfn are both 0.
As a result, when adding memory, dmesg will give the following wrong
message.
Initmem setup node 5 [mem 0x0000000000000000-0xffffffffffffffff]
On node 5 totalpages: 0
Built 5 zonelists in Node order, mobility grouping on. Total pages: 32588823
Policy zone: Normal
init_memory_mapping: [mem 0x60000000000-0x607ffffffff]
The solution is simple, just add the memory range to memblock a little
earlier, before hotadd_new_pgdat().
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Xishi Qiu <qiuxishi@huawei.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Taku Izumi <izumi.taku@jp.fujitsu.com>
Cc: Gu Zheng <guz.fnst@cn.fujitsu.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/memory_hotplug.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1248,6 +1248,14 @@ int __ref add_memory(int nid, u64 start,
mem_hotplug_begin();
+ /*
+ * Add new range to memblock so that when hotadd_new_pgdat() is called
+ * to allocate new pgdat, get_pfn_range_for_nid() will be able to find
+ * this new range and calculate total pages correctly. The range will
+ * be removed at hot-remove time.
+ */
+ memblock_add_node(start, size, nid);
+
new_node = !node_online(nid);
if (new_node) {
pgdat = hotadd_new_pgdat(nid, start);
@@ -1277,7 +1285,6 @@ int __ref add_memory(int nid, u64 start,
/* create new memmap entry */
firmware_map_add_hotplug(start, start + size, "System RAM");
- memblock_add_node(start, size, nid);
goto out;
@@ -1286,6 +1293,7 @@ error:
if (new_pgdat)
rollback_node_hotadd(nid, pgdat);
release_memory_resource(res);
+ memblock_remove(start, size);
out:
mem_hotplug_done();
next prev parent reply other threads:[~2015-09-19 17:53 UTC|newest]
Thread overview: 117+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-19 17:27 [PATCH 4.2 000/120] 4.2.1-stable review Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 001/120] DRM - radeon: Dont link train DisplayPort on HPD until we get the dpcd Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 002/120] drm/i915: apply the PCI_D0/D3 hibernation workaround everywhere on pre GEN6 Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 007/120] drm/radeon: fix HDMI quantization_range for pre-DCE5 asics Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 009/120] drm/amdgpu: Dont link train DisplayPort on HPD until we get the dpcd Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 011/120] drm/amdgpu: fix typo in dce11 watermark setup Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 012/120] drm/amdgpu: fix typo in dce10 " Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 013/120] drm/i915: Preserve SSC earlier Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 014/120] drm/qxl: validate monitors config modes Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 019/120] s390/setup: fix novx parameter Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 020/120] iio: bmg160: IIO_BUFFER and IIO_TRIGGERED_BUFFER are required Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 021/120] iio: event: Remove negative error code from iio_event_poll Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 022/120] iio: industrialio-buffer: Fix iio_buffer_poll return value Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 023/120] iio: adis16400: Fix adis16448 gyroscope scale Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 024/120] iio: Add inverse unit conversion macros Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 025/120] iio: adis16480: Fix scale factors Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 026/120] iio:accel:mma8452: fix _get_hp_filter_index Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 028/120] staging: rtl8192e: Fix log spamming in rtl8192_hard_data_xmit Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 029/120] staging: comedi: adl_pci7x3x: fix digital output on PCI-7230 Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 030/120] staging: comedi: usbduxsigma: dont clobber ai_timer in command test Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 031/120] staging: comedi: usbduxsigma: dont clobber ao_timer " Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 032/120] staging: unisys: Allow visorbus to autoload Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 033/120] PM / clk: dont return int on __pm_clk_enable() Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 034/120] clk: rockchip: rk3288: add CLK_SET_RATE_PARENT to sclk_mac Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 035/120] clk: exynos4: Fix wrong clock for Exynos4x12 ADC Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 036/120] clk: s5pv210: add missing call to samsung_clk_of_add_provider() Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 037/120] clk: pistachio: Fix 32bit integer overflows Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 038/120] clk: pistachio: Fix override of clk-pll settings from boot loader Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 4.2 039/120] clk: pistachio: Fix PLL rate calculation in integer mode Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 040/120] clk: pistachio: correct critical clock list Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 041/120] clk: versatile: off by one in clk_sp810_timerclken_of_get() Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 042/120] clk: pxa: fix core frequency reporting unit Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 043/120] clk: qcom: Set CLK_SET_RATE_PARENT on ce1 clocks Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 044/120] clk: qcom: Fix MSM8916 prng clock enable bit Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 045/120] PCI: Fix TI816X class code quirk Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 046/120] PCI: Add dev_flags bit to access VPD through function 0 Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 047/120] PCI: Add VPD function 0 quirk for Intel Ethernet devices Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 048/120] PCI: Disable async suspend/resume for JMicron multi-function SATA/AHCI Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 049/120] serial: 8250_uniphier: call clk_disable_unprepare() on failure path Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 050/120] tty: serial: 8250_omap: do not use RX DMA if pause is not supported Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 051/120] spi: bcm2835: set up spi-mode before asserting cs-gpio Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 052/120] spi: Fix regression in spi-bitbang-txrx.h Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 053/120] spi: orion: On a38x, implement "50MHZ SPI AC timing" Erratum No. FE-9144572 Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 054/120] spi: sh-msiof: Fix FIFO size to 64 word from 256 word Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 055/120] spi: img-spfi: check for timeout error before proceeding Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 056/120] spi: img-spfi: fix multiple calls to request gpio Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 057/120] spi: img-spfi: fix kbuild test robot warning Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 059/120] spi: dw: Allow interface drivers to limit data I/O to word sizes Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 060/120] USB: symbolserial: Use usb_get_serial_port_data Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 061/120] USB: qcserial: add HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 062/120] USB: ftdi_sio: Added custom PID for CustomWare products Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 063/120] USB: pl2303: fix baud-rate divisor calculations Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 064/120] libxfs: readahead of dir3 data blocks should use the read verifier Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 065/120] xfs: Fix xfs_attr_leafblock definition Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 066/120] xfs: Fix file type directory corruption for btree directories Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 067/120] xfs: return errors from partial I/O failures to files Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 068/120] usb: gadget: m66592-udc: forever loop in set_feature() Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 069/120] doc: usb: gadget-testing: using the updated testusb.c Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 070/120] usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytes Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 071/120] usb: gadget: f_uac2: finalize wMaxPacketSize according to bandwidth Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 072/120] usb: host: ehci-sys: delete useless bus_to_hcd conversion Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 073/120] tty: serial: men_z135_uart.c: Fix race between IRQ and set_termios() Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 074/120] ASoC: rt5640: fix line out no sound issue Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 075/120] ASoC: rt5645: Add struct dmi_system_id "Google Celes" for chrome platform Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 076/120] ASoC: samsung: Remove redundant arndale_audio_remove Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 077/120] ASoC: adav80x: Remove .read_flag_mask setting from adav80x_regmap_config Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 078/120] ASoC: arizona: Fix gain settings of FLL in free-run mode Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 079/120] ASoC: arizona: Poll for FLL clock OK rather than use interrupts Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 080/120] serial: 8250: dont bind to SMSC IrCC IR port Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 081/120] serial: 8250: bind to ALi Fast Infrared Controller (ALI5123) Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 082/120] serial: 8250_pci: Add support for Pericom PI7C9X795[1248] Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 083/120] serial: samsung: fix DMA mode enter condition for small FIFO sizes Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 084/120] serial: samsung: fix DMA for FIFO smaller than cache line size Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 085/120] crypto: vmx - Fixing AES-CTR counter bug Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 086/120] crypto: vmx - Fixing GHASH Key issue on little endian Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 087/120] crypto: ghash-clmulni: specify context size for ghash async algorithm Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 088/120] HID: usbhid: Fix the check for HID_RESET_PENDING in hid_io_error Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 089/120] HID: cp2112: fix byte order in SMBUS operations Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 090/120] HID: cp2112: fix I2C_SMBUS_BYTE write Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 091/120] KVM: MMU: fix validation of mmio page fault Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 092/120] KVM: PPC: Book3S HV: Exit on H_DOORBELL if HOST_IPI is set Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 093/120] KVM: PPC: Book3S HV: Fix race in reading change bit when removing HPTE Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 094/120] xtensa: fix threadptr reload on return to userspace Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 095/120] xtensa: fix kernel register spilling Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 096/120] devres: fix devres_get() Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 097/120] Doc: ABI: testing: configfs-usb-gadget-loopback Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 098/120] Doc: ABI: testing: configfs-usb-gadget-sourcesink Greg Kroah-Hartman
2015-09-19 17:28 ` [PATCH 4.2 099/120] spi/spi-xilinx: Fix spurious IRQ ACK on irq mode Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 100/120] spi/spi-xilinx: Fix mixed poll/irq mode Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 101/120] auxdisplay: ks0108: fix refcount Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 102/120] regulator: pbias: Fix broken pbias disable functionality Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 103/120] x86/mce: Reenable CMCI banks when swiching back to interrupt mode Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 104/120] soc/tegra: pmc: Avoid usage of uninitialized variable Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 105/120] of/address: Dont loop forever in of_find_matching_node_by_address() Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 106/120] ARM: BCM63xx: fix parameter to of_get_cpu_node in bcm63138_smp_boot_secondary Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 107/120] ARM: orion5x: fix legacy orion5x IRQ numbers Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 108/120] ARM: dts: fix clock-frequency of display timing0 for exynos3250-rinato Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 109/120] ARM: OMAP2+: DRA7: clockdomain: change l4per2_7xx_clkdm to SW_WKUP Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 110/120] ARM: rockchip: fix the CPU soft reset Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 111/120] ARM: dts: rockchip: fix rk3288 watchdog irq Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 112/120] ACPI, PCI: Penalize legacy IRQ used by ACPI SCI Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 113/120] drivercore: Fix unregistration path of platform devices Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 114/120] dm stats: report precise_timestamps and histogram in @stats_list output Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 115/120] dm cache: fix leaking of deferred bio prison cells Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 116/120] fs: Set the size of empty dirs to 0 Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 117/120] hpfs: update ctime and mtime on directory modification Greg Kroah-Hartman
2015-09-19 17:29 ` [PATCH 4.2 118/120] ocfs2: direct write will call ocfs2_rw_unlock() twice when doing aio+dio Greg Kroah-Hartman
2015-09-19 17:29 ` Greg Kroah-Hartman [this message]
2015-09-19 17:29 ` [PATCH 4.2 120/120] fs: create and use seq_show_option for escaping Greg Kroah-Hartman
2015-09-20 0:27 ` [PATCH 4.2 000/120] 4.2.1-stable review Guenter Roeck
2015-09-21 1:37 ` Greg Kroah-Hartman
2015-09-20 18:52 ` Hans-Peter Jansen
2015-09-20 22:18 ` Greg Kroah-Hartman
2015-09-21 5:10 ` Sudip Mukherjee
2015-09-21 5:37 ` Greg Kroah-Hartman
2015-09-21 16:23 ` Shuah Khan
2015-09-21 16:40 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150919171733.048014175@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=guz.fnst@cn.fujitsu.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=izumi.taku@jp.fujitsu.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@techsingularity.net \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=qiuxishi@huawei.com \
--cc=rientjes@google.com \
--cc=stable@vger.kernel.org \
--cc=tangchen@cn.fujitsu.com \
--cc=torvalds@linux-foundation.org \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox