Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 212726
b: refs/heads/master
c: edbe7d2
h: refs/heads/master
v: v3
  • Loading branch information
Yinghai Lu authored and H. Peter Anvin committed Aug 27, 2010
1 parent 9e39f33 commit 57fceb0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 88ba088c18457caaf8d2e5f8d36becc731a3d4f6
refs/heads/master: edbe7d23b4482e7f33179290bcff3b1feae1c5f3
2 changes: 2 additions & 0 deletions trunk/include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,8 @@ extern void free_bootmem_with_active_regions(int nid,
unsigned long max_low_pfn);
int add_from_early_node_map(struct range *range, int az,
int nr_range, int nid);
u64 __init find_memory_core_early(int nid, u64 size, u64 align,
u64 goal, u64 limit);
void *__alloc_memory_core_early(int nodeid, u64 size, u64 align,
u64 goal, u64 limit);
typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
Expand Down
36 changes: 36 additions & 0 deletions trunk/mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/pagemap.h>
#include <linux/jiffies.h>
#include <linux/bootmem.h>
#include <linux/memblock.h>
#include <linux/compiler.h>
#include <linux/kernel.h>
#include <linux/kmemcheck.h>
Expand Down Expand Up @@ -3612,6 +3613,41 @@ void __init free_bootmem_with_active_regions(int nid,
}
}

#ifdef CONFIG_HAVE_MEMBLOCK
u64 __init find_memory_core_early(int nid, u64 size, u64 align,
u64 goal, u64 limit)
{
int i;

/* Need to go over early_node_map to find out good range for node */
for_each_active_range_index_in_nid(i, nid) {
u64 addr;
u64 ei_start, ei_last;
u64 final_start, final_end;

ei_last = early_node_map[i].end_pfn;
ei_last <<= PAGE_SHIFT;
ei_start = early_node_map[i].start_pfn;
ei_start <<= PAGE_SHIFT;

final_start = max(ei_start, goal);
final_end = min(ei_last, limit);

if (final_start >= final_end)
continue;

addr = memblock_find_in_range(final_start, final_end, size, align);

if (addr == MEMBLOCK_ERROR)
continue;

return addr;
}

return MEMBLOCK_ERROR;
}
#endif

int __init add_from_early_node_map(struct range *range, int az,
int nr_range, int nid)
{
Expand Down

0 comments on commit 57fceb0

Please sign in to comment.