diff options
author | Praneeth Bajjuri | 2017-08-28 18:03:19 -0500 |
---|---|---|
committer | Praneeth Bajjuri | 2017-08-28 18:03:19 -0500 |
commit | dda8acaf6f2d9bddce62c305edf6b3071f04c136 (patch) | |
tree | 612f8b7b18ff3a84184ddc0ce456b9b0287cace6 /mm/memory_hotplug.c | |
parent | b22bbe0c5fa4fd5eb4609108a750b28a744a643e (diff) | |
parent | eabbcea7629d5f2ec91568f7bd104536614107db (diff) | |
download | kernel-omap-dda8acaf6f2d9bddce62c305edf6b3071f04c136.tar.gz kernel-omap-dda8acaf6f2d9bddce62c305edf6b3071f04c136.tar.xz kernel-omap-dda8acaf6f2d9bddce62c305edf6b3071f04c136.zip |
Merge branch 'p-ti-lsk-android-linux-4.4.y' of git://git.omapzoom.org/kernel/omap into 6AM.1.3-rvc-video6AM.1.3-rvc-video
* 'p-ti-lsk-android-linux-4.4.y' of git://git.omapzoom.org/kernel/omap: (2048 commits)
ARM: dts: dra7: Remove deprecated PCI compatible string
ARM: dts: dra76-evm: Enable x2 PCIe lanes
ARM: dts: DRA72x: Use PCIe compatible specific to dra72
ARM: dts: DRA74x: Use PCIe compatible specific to dra74
ARM: dts: dra7: Add properties to enable PCIe x2 lane mode
PCI: dwc: pci-dra7xx: Enable x2 mode support
PCI: dwc: dra7xx: Add support for SoC specific compatible strings
dt-bindings: PCI: dra7xx: Add properties to enable x2 lane in dra7
dt-bindings: PCI: dra7xx: Add SoC specific compatible strings
ARM: dts: dra7-evm: Move pcie RC node to common file
ARM: dts: dra76-evm: add higher speed MMC/SD modes
Linux 4.4.84
usb: qmi_wwan: add D-Link DWM-222 device ID
usb: optimize acpi companion search for usb port devices
perf/x86: Fix LBR related crashes on Intel Atom
pids: make task_tgid_nr_ns() safe
Sanitize 'move_pages()' permission checks
irqchip/atmel-aic: Fix unbalanced refcount in aic_common_rtc_irq_fixup()
irqchip/atmel-aic: Fix unbalanced of_node_put() in aic_common_irq_fixup()
x86/asm/64: Clear AC on NMI entries
...
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Conflicts:
arch/arm/boot/dts/Makefile
drivers/gpu/drm/omapdrm/dss/dispc.c
Diffstat (limited to 'mm/memory_hotplug.c')
-rw-r--r-- | mm/memory_hotplug.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index a042a9d537bb..a18923e4359d 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -1371,17 +1371,20 @@ int is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages) | |||
1371 | } | 1371 | } |
1372 | 1372 | ||
1373 | /* | 1373 | /* |
1374 | * Confirm all pages in a range [start, end) is belongs to the same zone. | 1374 | * Confirm all pages in a range [start, end) belong to the same zone. |
1375 | * When true, return its valid [start, end). | ||
1375 | */ | 1376 | */ |
1376 | int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn) | 1377 | int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn, |
1378 | unsigned long *valid_start, unsigned long *valid_end) | ||
1377 | { | 1379 | { |
1378 | unsigned long pfn, sec_end_pfn; | 1380 | unsigned long pfn, sec_end_pfn; |
1381 | unsigned long start, end; | ||
1379 | struct zone *zone = NULL; | 1382 | struct zone *zone = NULL; |
1380 | struct page *page; | 1383 | struct page *page; |
1381 | int i; | 1384 | int i; |
1382 | for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn); | 1385 | for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn + 1); |
1383 | pfn < end_pfn; | 1386 | pfn < end_pfn; |
1384 | pfn = sec_end_pfn + 1, sec_end_pfn += PAGES_PER_SECTION) { | 1387 | pfn = sec_end_pfn, sec_end_pfn += PAGES_PER_SECTION) { |
1385 | /* Make sure the memory section is present first */ | 1388 | /* Make sure the memory section is present first */ |
1386 | if (!present_section_nr(pfn_to_section_nr(pfn))) | 1389 | if (!present_section_nr(pfn_to_section_nr(pfn))) |
1387 | continue; | 1390 | continue; |
@@ -1397,10 +1400,20 @@ int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn) | |||
1397 | page = pfn_to_page(pfn + i); | 1400 | page = pfn_to_page(pfn + i); |
1398 | if (zone && page_zone(page) != zone) | 1401 | if (zone && page_zone(page) != zone) |
1399 | return 0; | 1402 | return 0; |
1403 | if (!zone) | ||
1404 | start = pfn + i; | ||
1400 | zone = page_zone(page); | 1405 | zone = page_zone(page); |
1406 | end = pfn + MAX_ORDER_NR_PAGES; | ||
1401 | } | 1407 | } |
1402 | } | 1408 | } |
1403 | return 1; | 1409 | |
1410 | if (zone) { | ||
1411 | *valid_start = start; | ||
1412 | *valid_end = end; | ||
1413 | return 1; | ||
1414 | } else { | ||
1415 | return 0; | ||
1416 | } | ||
1404 | } | 1417 | } |
1405 | 1418 | ||
1406 | /* | 1419 | /* |
@@ -1718,6 +1731,7 @@ static int __ref __offline_pages(unsigned long start_pfn, | |||
1718 | long offlined_pages; | 1731 | long offlined_pages; |
1719 | int ret, drain, retry_max, node; | 1732 | int ret, drain, retry_max, node; |
1720 | unsigned long flags; | 1733 | unsigned long flags; |
1734 | unsigned long valid_start, valid_end; | ||
1721 | struct zone *zone; | 1735 | struct zone *zone; |
1722 | struct memory_notify arg; | 1736 | struct memory_notify arg; |
1723 | 1737 | ||
@@ -1728,10 +1742,10 @@ static int __ref __offline_pages(unsigned long start_pfn, | |||
1728 | return -EINVAL; | 1742 | return -EINVAL; |
1729 | /* This makes hotplug much easier...and readable. | 1743 | /* This makes hotplug much easier...and readable. |
1730 | we assume this for now. .*/ | 1744 | we assume this for now. .*/ |
1731 | if (!test_pages_in_a_zone(start_pfn, end_pfn)) | 1745 | if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start, &valid_end)) |
1732 | return -EINVAL; | 1746 | return -EINVAL; |
1733 | 1747 | ||
1734 | zone = page_zone(pfn_to_page(start_pfn)); | 1748 | zone = page_zone(pfn_to_page(valid_start)); |
1735 | node = zone_to_nid(zone); | 1749 | node = zone_to_nid(zone); |
1736 | nr_pages = end_pfn - start_pfn; | 1750 | nr_pages = end_pfn - start_pfn; |
1737 | 1751 | ||