Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 212698
b: refs/heads/master
c: bf23c51
h: refs/heads/master
v: v3
  • Loading branch information
Benjamin Herrenschmidt committed Aug 5, 2010
1 parent 74f889a commit 2c569bb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 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: 4734b594c6ca1be796d30c82d93fdf5160f45124
refs/heads/master: bf23c51f1f49d3960f3cd8e3d2e7f943d9c41042
7 changes: 4 additions & 3 deletions trunk/include/linux/memblock.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@

#include <asm/memblock.h>

#define MAX_MEMBLOCK_REGIONS 128
#define INIT_MEMBLOCK_REGIONS 128

struct memblock_region {
phys_addr_t base;
phys_addr_t size;
};

struct memblock_type {
unsigned long cnt;
struct memblock_region regions[MAX_MEMBLOCK_REGIONS+1];
unsigned long cnt; /* number of regions */
unsigned long max; /* size of the allocated array */
struct memblock_region *regions;
};

struct memblock {
Expand Down
10 changes: 9 additions & 1 deletion trunk/mm/memblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
struct memblock memblock;

static int memblock_debug;
static struct memblock_region memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS + 1];
static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIONS + 1];

static int __init early_memblock(char *p)
{
Expand Down Expand Up @@ -104,6 +106,12 @@ static void memblock_coalesce_regions(struct memblock_type *type,

void __init memblock_init(void)
{
/* Hookup the initial arrays */
memblock.memory.regions = memblock_memory_init_regions;
memblock.memory.max = INIT_MEMBLOCK_REGIONS;
memblock.reserved.regions = memblock_reserved_init_regions;
memblock.reserved.max = INIT_MEMBLOCK_REGIONS;

/* Create a dummy zero size MEMBLOCK which will get coalesced away later.
* This simplifies the memblock_add() code below...
*/
Expand Down Expand Up @@ -169,7 +177,7 @@ static long memblock_add_region(struct memblock_type *type, phys_addr_t base, ph

if (coalesced)
return coalesced;
if (type->cnt >= MAX_MEMBLOCK_REGIONS)
if (type->cnt >= type->max)
return -1;

/* Couldn't coalesce the MEMBLOCK, so add it to the sorted table. */
Expand Down

0 comments on commit 2c569bb

Please sign in to comment.