Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 145775
b: refs/heads/master
c: 45fbe3e
h: refs/heads/master
i:
  145773: f3cdb39
  145771: d393ae9
  145767: a4d162f
  145759: ab6ef6e
v: v3
  • Loading branch information
Linus Torvalds authored and Ingo Molnar committed May 11, 2009
1 parent d4887fe commit 395f8ad
Show file tree
Hide file tree
Showing 2 changed files with 36 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: 134cbf35c739bf89c51fd975a33a6b87507482c4
refs/heads/master: 45fbe3ee01b8e463b28c2751b5dcc0cbdc142d90
35 changes: 35 additions & 0 deletions trunk/arch/x86/kernel/e820.c
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,23 @@ void __init e820_reserve_resources(void)
}
}

/* How much should we pad RAM ending depending on where it is? */
static unsigned long ram_alignment(resource_size_t pos)
{
unsigned long mb = pos >> 20;

/* To 64kB in the first megabyte */
if (!mb)
return 64*1024;

/* To 1MB in the first 16MB */
if (mb < 16)
return 1024*1024;

/* To 32MB for anything above that */
return 32*1024*1024;
}

void __init e820_reserve_resources_late(void)
{
int i;
Expand All @@ -1382,6 +1399,24 @@ void __init e820_reserve_resources_late(void)
insert_resource_expand_to_fit(&iomem_resource, res);
res++;
}

/*
* Try to bump up RAM regions to reasonable boundaries to
* avoid stolen RAM:
*/
for (i = 0; i < e820.nr_map; i++) {
struct e820entry *entry = &e820_saved.map[i];
resource_size_t start, end;

if (entry->type != E820_RAM)
continue;
start = entry->addr + entry->size;
end = round_up(start, ram_alignment(start));
if (start == end)
continue;
reserve_region_with_split(&iomem_resource, start,
end - 1, "RAM buffer");
}
}

char *__init default_machine_specific_memory_setup(void)
Expand Down

0 comments on commit 395f8ad

Please sign in to comment.