Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 99743
b: refs/heads/master
c: cc1a9d8
h: refs/heads/master
i:
  99741: 0bc66e2
  99739: 1c4797a
  99735: 0c4fdd3
  99727: 0d65bf2
  99711: 7b07a8d
v: v3
  • Loading branch information
Yinghai Lu authored and Ingo Molnar committed Jun 10, 2008
1 parent 4908c75 commit d42542a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: db3660c1905293b91653e07f7857576df71ebf28
refs/heads/master: cc1a9d86ce989083703c4bdc11b75a87e1cc404a
2 changes: 1 addition & 1 deletion trunk/arch/x86/mm/discontig_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ static unsigned long calculate_numa_remap_pages(void)

node_end_pfn[nid] -= size;
node_remap_start_pfn[nid] = node_end_pfn[nid];
shrink_active_range(nid, old_end_pfn, node_end_pfn[nid]);
shrink_active_range(nid, node_end_pfn[nid]);
}
printk("Reserving total of %ld pages for numa KVA remap\n",
reserve_pages);
Expand Down
3 changes: 1 addition & 2 deletions trunk/include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -997,8 +997,7 @@ extern void free_area_init_node(int nid, pg_data_t *pgdat,
extern void free_area_init_nodes(unsigned long *max_zone_pfn);
extern void add_active_range(unsigned int nid, unsigned long start_pfn,
unsigned long end_pfn);
extern void shrink_active_range(unsigned int nid, unsigned long old_end_pfn,
unsigned long new_end_pfn);
extern void shrink_active_range(unsigned int nid, unsigned long new_end_pfn);
extern void push_node_boundaries(unsigned int nid, unsigned long start_pfn,
unsigned long end_pfn);
extern void remove_all_active_ranges(void);
Expand Down
44 changes: 34 additions & 10 deletions trunk/mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3579,25 +3579,49 @@ void __init add_active_range(unsigned int nid, unsigned long start_pfn,
/**
* shrink_active_range - Shrink an existing registered range of PFNs
* @nid: The node id the range is on that should be shrunk
* @old_end_pfn: The old end PFN of the range
* @new_end_pfn: The new PFN of the range
*
* i386 with NUMA use alloc_remap() to store a node_mem_map on a local node.
* The map is kept at the end physical page range that has already been
* registered with add_active_range(). This function allows an arch to shrink
* an existing registered range.
* The map is kept near the end physical page range that has already been
* registered. This function allows an arch to shrink an existing registered
* range.
*/
void __init shrink_active_range(unsigned int nid, unsigned long old_end_pfn,
unsigned long new_end_pfn)
void __init shrink_active_range(unsigned int nid, unsigned long new_end_pfn)
{
int i;
int i, j;
int removed = 0;

/* Find the old active region end and shrink */
for_each_active_range_index_in_nid(i, nid)
if (early_node_map[i].end_pfn == old_end_pfn) {
for_each_active_range_index_in_nid(i, nid) {
if (early_node_map[i].start_pfn >= new_end_pfn) {
/* clear it */
early_node_map[i].end_pfn = 0;
removed = 1;
continue;
}
if (early_node_map[i].end_pfn > new_end_pfn) {
early_node_map[i].end_pfn = new_end_pfn;
break;
continue;
}
}

if (!removed)
return;

/* remove the blank ones */
for (i = nr_nodemap_entries - 1; i > 0; i--) {
if (early_node_map[i].nid != nid)
continue;
if (early_node_map[i].end_pfn)
continue;
/* we found it, get rid of it */
for (j = i; j < nr_nodemap_entries - 1; j++)
memcpy(&early_node_map[j], &early_node_map[j+1],
sizeof(early_node_map[j]));
j = nr_nodemap_entries - 1;
memset(&early_node_map[j], 0, sizeof(early_node_map[j]));
nr_nodemap_entries--;
}
}

/**
Expand Down

0 comments on commit d42542a

Please sign in to comment.