projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
UPSTREAM: PCI: rockchip: Fix rockchip_pcie_probe() error path to free resource list
[firefly-linux-kernel-4.4.55.git]
/
mm
/
memory_hotplug.c
diff --git
a/mm/memory_hotplug.c
b/mm/memory_hotplug.c
index a042a9d537bb31984d6b2a8d3cc8ae1e54361e4f..a18923e4359d941ae322c0f5bee451b423a3e645 100644
(file)
--- 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)
}
/*
}
/*
- * Confirm all pages in a range [start, end) is belongs to the same zone.
+ * Confirm all pages in a range [start, end) belong to the same zone.
+ * When true, return its valid [start, end).
*/
*/
-int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn)
+int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn,
+ unsigned long *valid_start, unsigned long *valid_end)
{
unsigned long pfn, sec_end_pfn;
{
unsigned long pfn, sec_end_pfn;
+ unsigned long start, end;
struct zone *zone = NULL;
struct page *page;
int i;
struct zone *zone = NULL;
struct page *page;
int i;
- for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn);
+ for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn
+ 1
);
pfn < end_pfn;
pfn < end_pfn;
- pfn = sec_end_pfn
+ 1
, sec_end_pfn += PAGES_PER_SECTION) {
+ pfn = sec_end_pfn, sec_end_pfn += PAGES_PER_SECTION) {
/* Make sure the memory section is present first */
if (!present_section_nr(pfn_to_section_nr(pfn)))
continue;
/* Make sure the memory section is present first */
if (!present_section_nr(pfn_to_section_nr(pfn)))
continue;
@@
-1397,10
+1400,20
@@
int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn)
page = pfn_to_page(pfn + i);
if (zone && page_zone(page) != zone)
return 0;
page = pfn_to_page(pfn + i);
if (zone && page_zone(page) != zone)
return 0;
+ if (!zone)
+ start = pfn + i;
zone = page_zone(page);
zone = page_zone(page);
+ end = pfn + MAX_ORDER_NR_PAGES;
}
}
}
}
- return 1;
+
+ if (zone) {
+ *valid_start = start;
+ *valid_end = end;
+ return 1;
+ } else {
+ return 0;
+ }
}
/*
}
/*
@@
-1718,6
+1731,7
@@
static int __ref __offline_pages(unsigned long start_pfn,
long offlined_pages;
int ret, drain, retry_max, node;
unsigned long flags;
long offlined_pages;
int ret, drain, retry_max, node;
unsigned long flags;
+ unsigned long valid_start, valid_end;
struct zone *zone;
struct memory_notify arg;
struct zone *zone;
struct memory_notify arg;
@@
-1728,10
+1742,10
@@
static int __ref __offline_pages(unsigned long start_pfn,
return -EINVAL;
/* This makes hotplug much easier...and readable.
we assume this for now. .*/
return -EINVAL;
/* This makes hotplug much easier...and readable.
we assume this for now. .*/
- if (!test_pages_in_a_zone(start_pfn, end_pfn))
+ if (!test_pages_in_a_zone(start_pfn, end_pfn
, &valid_start, &valid_end
))
return -EINVAL;
return -EINVAL;
- zone = page_zone(pfn_to_page(
start_pfn
));
+ zone = page_zone(pfn_to_page(
valid_start
));
node = zone_to_nid(zone);
nr_pages = end_pfn - start_pfn;
node = zone_to_nid(zone);
nr_pages = end_pfn - start_pfn;