mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge branch 'for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock.git
This commit is contained in:
@@ -262,12 +262,6 @@ void __init kasan_init(void)
|
||||
&pa_start, &pa_end, &arm_lowmem_limit);
|
||||
end = __va(arm_lowmem_limit);
|
||||
}
|
||||
if (start >= end) {
|
||||
pr_info("Skipping invalid memory block %pa-%pa (virtual %p-%p)\n",
|
||||
&pa_start, &pa_end, start, end);
|
||||
continue;
|
||||
}
|
||||
|
||||
create_mapping(start, end);
|
||||
}
|
||||
|
||||
|
||||
@@ -353,9 +353,6 @@ static void __init kasan_init_shadow(void)
|
||||
void *start = (void *)__phys_to_virt(pa_start);
|
||||
void *end = (void *)__phys_to_virt(pa_end);
|
||||
|
||||
if (start >= end)
|
||||
break;
|
||||
|
||||
kasan_map_populate((unsigned long)kasan_mem_to_shadow(start),
|
||||
(unsigned long)kasan_mem_to_shadow(end),
|
||||
early_pfn_to_nid(virt_to_pfn(start)));
|
||||
|
||||
@@ -216,7 +216,6 @@ static int __init fake_numa_init(void)
|
||||
phys_addr_t start = memblock_start_of_DRAM();
|
||||
phys_addr_t end = memblock_end_of_DRAM() - 1;
|
||||
|
||||
node_set(0, numa_nodes_parsed);
|
||||
pr_info("Faking a node at [mem %pap-%pap]\n", &start, &end);
|
||||
|
||||
return numa_add_memblk(0, start, end + 1);
|
||||
|
||||
@@ -305,9 +305,6 @@ void __init kasan_init(void)
|
||||
void *start = (void *)phys_to_virt(pa_start);
|
||||
void *end = (void *)phys_to_virt(pa_end);
|
||||
|
||||
if (start >= end)
|
||||
break;
|
||||
|
||||
kasan_map_populate((unsigned long)mem_to_shadow(start),
|
||||
(unsigned long)mem_to_shadow(end), NUMA_NO_NODE);
|
||||
}
|
||||
|
||||
@@ -68,9 +68,6 @@ static void __init kasan_init_phys_region(void *start, void *end)
|
||||
unsigned long k_start, k_end, k_cur;
|
||||
void *va;
|
||||
|
||||
if (start >= end)
|
||||
return;
|
||||
|
||||
k_start = ALIGN_DOWN((unsigned long)kasan_mem_to_shadow(start), PAGE_SIZE);
|
||||
k_end = ALIGN((unsigned long)kasan_mem_to_shadow(end), PAGE_SIZE);
|
||||
|
||||
|
||||
@@ -24,9 +24,6 @@ static void __init kasan_init_phys_region(void *start, void *end)
|
||||
unsigned long k_start, k_end, k_cur;
|
||||
void *va;
|
||||
|
||||
if (start >= end)
|
||||
return;
|
||||
|
||||
k_start = ALIGN_DOWN((unsigned long)kasan_mem_to_shadow(start), PAGE_SIZE);
|
||||
k_end = ALIGN((unsigned long)kasan_mem_to_shadow(end), PAGE_SIZE);
|
||||
|
||||
|
||||
@@ -1237,8 +1237,6 @@ static void __init create_linear_mapping_page_table(void)
|
||||
|
||||
/* Map all memory banks in the linear mapping */
|
||||
for_each_mem_range(i, &start, &end) {
|
||||
if (start >= end)
|
||||
break;
|
||||
if (start <= __pa(PAGE_OFFSET) &&
|
||||
__pa(PAGE_OFFSET) < end)
|
||||
start = __pa(PAGE_OFFSET);
|
||||
|
||||
@@ -512,9 +512,6 @@ void __init kasan_init(void)
|
||||
void *start = (void *)__va(p_start);
|
||||
void *end = (void *)__va(p_end);
|
||||
|
||||
if (start >= end)
|
||||
break;
|
||||
|
||||
kasan_populate(kasan_mem_to_shadow(start), kasan_mem_to_shadow(end));
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,6 @@ int __init amd_numa_init(void)
|
||||
|
||||
prevbase = base;
|
||||
numa_add_memblk(nodeid, base, limit);
|
||||
node_set(nodeid, numa_nodes_parsed);
|
||||
}
|
||||
|
||||
if (nodes_empty(numa_nodes_parsed))
|
||||
|
||||
@@ -216,7 +216,6 @@ static int __init dummy_numa_init(void)
|
||||
printk(KERN_INFO "Faking a node at [mem %#018Lx-%#018Lx]\n",
|
||||
0LLU, PFN_PHYS(max_pfn) - 1);
|
||||
|
||||
node_set(0, numa_nodes_parsed);
|
||||
node_set(0, numa_phys_nodes_parsed);
|
||||
numa_add_memblk(0, 0, PFN_PHYS(max_pfn));
|
||||
|
||||
|
||||
@@ -221,9 +221,6 @@ static int __init numa_register_nodes(void)
|
||||
node_set_online(nid);
|
||||
}
|
||||
|
||||
/* Setup online nodes to actual nodes*/
|
||||
node_possible_map = numa_nodes_parsed;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -279,7 +276,6 @@ static int __init dummy_numa_init(void)
|
||||
pr_err("NUMA init failed\n");
|
||||
return ret;
|
||||
}
|
||||
node_set(0, numa_nodes_parsed);
|
||||
|
||||
numa_off = true;
|
||||
return 0;
|
||||
|
||||
@@ -59,11 +59,8 @@ static int __init of_numa_parse_memory_nodes(void)
|
||||
r = -EINVAL;
|
||||
}
|
||||
|
||||
for (i = 0; !r && !of_address_to_resource(np, i, &rsrc); i++) {
|
||||
for (i = 0; !r && !of_address_to_resource(np, i, &rsrc); i++)
|
||||
r = numa_add_memblk(nid, rsrc.start, rsrc.end + 1);
|
||||
if (!r)
|
||||
node_set(nid, numa_nodes_parsed);
|
||||
}
|
||||
|
||||
if (!i || r) {
|
||||
of_node_put(np);
|
||||
|
||||
+2
-5
@@ -4470,15 +4470,12 @@ hugetlb_early_param("default_hugepagesz", default_hugepagesz_setup);
|
||||
void __init hugetlb_bootmem_set_nodes(void)
|
||||
{
|
||||
int i, nid;
|
||||
unsigned long start_pfn, end_pfn;
|
||||
|
||||
if (!nodes_empty(hugetlb_bootmem_nodes))
|
||||
return;
|
||||
|
||||
for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, &nid) {
|
||||
if (end_pfn > start_pfn)
|
||||
node_set(nid, hugetlb_bootmem_nodes);
|
||||
}
|
||||
for_each_mem_pfn_range(i, MAX_NUMNODES, NULL, NULL, &nid)
|
||||
node_set(nid, hugetlb_bootmem_nodes);
|
||||
}
|
||||
|
||||
void __init hugetlb_bootmem_alloc(void)
|
||||
|
||||
+1
-3
@@ -2313,10 +2313,8 @@ static void __init free_unused_memmap(void)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPARSEMEM
|
||||
if (!IS_ALIGNED(prev_end, PAGES_PER_SECTION)) {
|
||||
prev_end = pageblock_align(end);
|
||||
if (!IS_ALIGNED(prev_end, PAGES_PER_SECTION))
|
||||
free_memmap(prev_end, ALIGN(prev_end, PAGES_PER_SECTION));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+4
-61
@@ -336,8 +336,7 @@ static unsigned long __init early_calculate_totalpages(void)
|
||||
unsigned long pages = end_pfn - start_pfn;
|
||||
|
||||
totalpages += pages;
|
||||
if (pages)
|
||||
node_set_state(nid, N_MEMORY);
|
||||
node_set_state(nid, N_MEMORY);
|
||||
}
|
||||
return totalpages;
|
||||
}
|
||||
@@ -795,28 +794,6 @@ void __meminit init_deferred_page(unsigned long pfn, int nid)
|
||||
__init_deferred_page(pfn, nid);
|
||||
}
|
||||
|
||||
/* If zone is ZONE_MOVABLE but memory is mirrored, it is an overlapped init */
|
||||
static bool __meminit
|
||||
overlap_memmap_init(unsigned long zone, unsigned long *pfn)
|
||||
{
|
||||
static struct memblock_region *r __meminitdata;
|
||||
|
||||
if (mirrored_kernelcore && zone == ZONE_MOVABLE) {
|
||||
if (!r || *pfn >= memblock_region_memory_end_pfn(r)) {
|
||||
for_each_mem_region(r) {
|
||||
if (*pfn < memblock_region_memory_end_pfn(r))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (*pfn >= memblock_region_memory_base_pfn(r) &&
|
||||
memblock_is_mirror(r)) {
|
||||
*pfn = memblock_region_memory_end_pfn(r);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Only struct pages that correspond to ranges defined by memblock.memory
|
||||
* are zeroed and initialized by going through __init_single_page() during
|
||||
@@ -903,8 +880,6 @@ void __meminit memmap_init_range(unsigned long size, int nid, unsigned long zone
|
||||
* function. They do not exist on hotplugged memory.
|
||||
*/
|
||||
if (context == MEMINIT_EARLY) {
|
||||
if (overlap_memmap_init(zone, &pfn))
|
||||
continue;
|
||||
if (defer_init(nid, pfn, zone_end_pfn)) {
|
||||
deferred_struct_pages = true;
|
||||
break;
|
||||
@@ -1169,9 +1144,8 @@ static void __init adjust_zone_range_for_zone_movable(int nid,
|
||||
arch_zone_highest_possible_pfn[movable_zone]);
|
||||
|
||||
/* Adjust for ZONE_MOVABLE starting within this range */
|
||||
} else if (!mirrored_kernelcore &&
|
||||
*zone_start_pfn < zone_movable_pfn[nid] &&
|
||||
*zone_end_pfn > zone_movable_pfn[nid]) {
|
||||
} else if (*zone_start_pfn < zone_movable_pfn[nid] &&
|
||||
*zone_end_pfn > zone_movable_pfn[nid]) {
|
||||
*zone_end_pfn = zone_movable_pfn[nid];
|
||||
|
||||
/* Check if this whole range is within ZONE_MOVABLE */
|
||||
@@ -1219,40 +1193,11 @@ static unsigned long __init zone_absent_pages_in_node(int nid,
|
||||
unsigned long zone_start_pfn,
|
||||
unsigned long zone_end_pfn)
|
||||
{
|
||||
unsigned long nr_absent;
|
||||
|
||||
/* zone is empty, we don't have any absent pages */
|
||||
if (zone_start_pfn == zone_end_pfn)
|
||||
return 0;
|
||||
|
||||
nr_absent = __absent_pages_in_range(nid, zone_start_pfn, zone_end_pfn);
|
||||
|
||||
/*
|
||||
* ZONE_MOVABLE handling.
|
||||
* Treat pages to be ZONE_MOVABLE in ZONE_NORMAL as absent pages
|
||||
* and vice versa.
|
||||
*/
|
||||
if (mirrored_kernelcore && zone_movable_pfn[nid]) {
|
||||
unsigned long start_pfn, end_pfn;
|
||||
struct memblock_region *r;
|
||||
|
||||
for_each_mem_region(r) {
|
||||
start_pfn = clamp(memblock_region_memory_base_pfn(r),
|
||||
zone_start_pfn, zone_end_pfn);
|
||||
end_pfn = clamp(memblock_region_memory_end_pfn(r),
|
||||
zone_start_pfn, zone_end_pfn);
|
||||
|
||||
if (zone_type == ZONE_MOVABLE &&
|
||||
memblock_is_mirror(r))
|
||||
nr_absent += end_pfn - start_pfn;
|
||||
|
||||
if (zone_type == ZONE_NORMAL &&
|
||||
!memblock_is_mirror(r))
|
||||
nr_absent += end_pfn - start_pfn;
|
||||
}
|
||||
}
|
||||
|
||||
return nr_absent;
|
||||
return __absent_pages_in_range(nid, zone_start_pfn, zone_end_pfn);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1722,7 +1667,6 @@ static void __init free_area_init_node(int nid)
|
||||
|
||||
pgdat->node_id = nid;
|
||||
pgdat->node_start_pfn = start_pfn;
|
||||
pgdat->per_cpu_nodestats = NULL;
|
||||
|
||||
if (start_pfn != end_pfn) {
|
||||
pr_info("Initmem setup node %d [mem %#018Lx-%#018Lx]\n", nid,
|
||||
@@ -1844,7 +1788,6 @@ static void __init free_area_init(void)
|
||||
}
|
||||
|
||||
/* Find the PFNs that ZONE_MOVABLE begins at in each node */
|
||||
memset(zone_movable_pfn, 0, sizeof(zone_movable_pfn));
|
||||
find_zone_movable_pfns_for_nodes();
|
||||
|
||||
/* Print out the zone ranges */
|
||||
|
||||
+19
-22
@@ -17,20 +17,6 @@ nodemask_t numa_nodes_parsed __initdata;
|
||||
static struct numa_meminfo numa_meminfo __initdata_or_meminfo;
|
||||
static struct numa_meminfo numa_reserved_meminfo __initdata_or_meminfo;
|
||||
|
||||
/*
|
||||
* Set nodes, which have memory in @mi, in *@nodemask.
|
||||
*/
|
||||
static void __init numa_nodemask_from_meminfo(nodemask_t *nodemask,
|
||||
const struct numa_meminfo *mi)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(mi->blk); i++)
|
||||
if (mi->blk[i].start != mi->blk[i].end &&
|
||||
mi->blk[i].nid != NUMA_NO_NODE)
|
||||
node_set(mi->blk[i].nid, *nodemask);
|
||||
}
|
||||
|
||||
/**
|
||||
* numa_reset_distance - Reset NUMA distance table
|
||||
*
|
||||
@@ -56,7 +42,6 @@ static int __init numa_alloc_distance(void)
|
||||
|
||||
/* size the new table and allocate it */
|
||||
nodes_parsed = numa_nodes_parsed;
|
||||
numa_nodemask_from_meminfo(&nodes_parsed, &numa_meminfo);
|
||||
|
||||
for_each_node_mask(i, nodes_parsed)
|
||||
cnt = i;
|
||||
@@ -135,13 +120,20 @@ EXPORT_SYMBOL(__node_distance);
|
||||
static int __init numa_add_memblk_to(int nid, u64 start, u64 end,
|
||||
struct numa_meminfo *mi)
|
||||
{
|
||||
/* whine about and ignore invalid nid */
|
||||
if (nid < 0 || nid >= MAX_NUMNODES) {
|
||||
pr_warn("Warning: invalid memblk node id %d [mem %#010Lx-%#010Lx]\n",
|
||||
nid, start, end - 1);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* ignore zero length blks */
|
||||
if (start == end)
|
||||
return 0;
|
||||
|
||||
/* whine about and ignore invalid blks */
|
||||
if (start > end || nid < 0 || nid >= MAX_NUMNODES) {
|
||||
pr_warn("Warning: invalid memblk node %d [mem %#010Lx-%#010Lx]\n",
|
||||
/* whine about and ignore invalid ranges */
|
||||
if (start > end) {
|
||||
pr_warn("Warning: invalid memblk range for node %d [mem %#010Lx-%#010Lx]\n",
|
||||
nid, start, end - 1);
|
||||
return 0;
|
||||
}
|
||||
@@ -193,13 +185,20 @@ static void __init numa_move_tail_memblk(struct numa_meminfo *dst, int idx,
|
||||
* @end: End address of the new memblk
|
||||
*
|
||||
* Add a new memblk to the default numa_meminfo.
|
||||
* On success @nid is also set in numa_nodes_parsed.
|
||||
*
|
||||
* RETURNS:
|
||||
* 0 on success, -errno on failure.
|
||||
*/
|
||||
int __init numa_add_memblk(int nid, u64 start, u64 end)
|
||||
{
|
||||
return numa_add_memblk_to(nid, start, end, &numa_meminfo);
|
||||
int ret;
|
||||
|
||||
ret = numa_add_memblk_to(nid, start, end, &numa_meminfo);
|
||||
if (!ret)
|
||||
node_set(nid, numa_nodes_parsed);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,8 +255,7 @@ int __init numa_cleanup_meminfo(struct numa_meminfo *mi)
|
||||
|
||||
/* preserve info for non-RAM areas above 'max_pfn': */
|
||||
if (bi->end > high) {
|
||||
numa_add_memblk_to(bi->nid, high, bi->end,
|
||||
&numa_reserved_meminfo);
|
||||
numa_add_reserved_memblk(bi->nid, high, bi->end);
|
||||
bi->end = high;
|
||||
}
|
||||
|
||||
@@ -401,7 +399,6 @@ static int __init numa_register_meminfo(struct numa_meminfo *mi)
|
||||
|
||||
/* Account for nodes with cpus and no memory */
|
||||
node_possible_map = numa_nodes_parsed;
|
||||
numa_nodemask_from_meminfo(&node_possible_map, mi);
|
||||
if (WARN_ON(nodes_empty(node_possible_map)))
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user