Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28901
b: refs/heads/master
c: 718127c
h: refs/heads/master
i:
  28899: 5f5335b
v: v3
  • Loading branch information
Yasunori Goto authored and Linus Torvalds committed Jun 23, 2006
1 parent ee56e44 commit 73fc2c4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 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: 86356ab147669bd3bcb2149fd9561d1280835c24
refs/heads/master: 718127cc3170454f4aa274fdd2f1e01574fecd66
3 changes: 3 additions & 0 deletions trunk/include/linux/mmzone.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ void wakeup_kswapd(struct zone *zone, int order);
int zone_watermark_ok(struct zone *z, int order, unsigned long mark,
int classzone_idx, int alloc_flags);

extern int init_currently_empty_zone(struct zone *zone, unsigned long start_pfn,
unsigned long size);

#ifdef CONFIG_HAVE_MEMORY_PRESENT
void memory_present(int nid, unsigned long start, unsigned long end);
#else
Expand Down
15 changes: 13 additions & 2 deletions trunk/mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,23 @@

extern void zonetable_add(struct zone *zone, int nid, int zid, unsigned long pfn,
unsigned long size);
static void __add_zone(struct zone *zone, unsigned long phys_start_pfn)
static int __add_zone(struct zone *zone, unsigned long phys_start_pfn)
{
struct pglist_data *pgdat = zone->zone_pgdat;
int nr_pages = PAGES_PER_SECTION;
int nid = pgdat->node_id;
int zone_type;

zone_type = zone - pgdat->node_zones;
if (!populated_zone(zone)) {
int ret = 0;
ret = init_currently_empty_zone(zone, phys_start_pfn, nr_pages);
if (ret < 0)
return ret;
}
memmap_init_zone(nr_pages, nid, zone_type, phys_start_pfn);
zonetable_add(zone, nid, zone_type, phys_start_pfn, nr_pages);
return 0;
}

extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
Expand All @@ -50,7 +57,11 @@ static int __add_section(struct zone *zone, unsigned long phys_start_pfn)
if (ret < 0)
return ret;

__add_zone(zone, phys_start_pfn);
ret = __add_zone(zone, phys_start_pfn);

if (ret < 0)
return ret;

return register_new_memory(__pfn_to_section(phys_start_pfn));
}

Expand Down
11 changes: 8 additions & 3 deletions trunk/mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2050,8 +2050,9 @@ static __meminit void zone_pcp_init(struct zone *zone)
zone->name, zone->present_pages, batch);
}

static __meminit void init_currently_empty_zone(struct zone *zone,
unsigned long zone_start_pfn, unsigned long size)
__meminit int init_currently_empty_zone(struct zone *zone,
unsigned long zone_start_pfn,
unsigned long size)
{
struct pglist_data *pgdat = zone->zone_pgdat;

Expand All @@ -2063,6 +2064,8 @@ static __meminit void init_currently_empty_zone(struct zone *zone,
memmap_init(size, pgdat->node_id, zone_idx(zone), zone_start_pfn);

zone_init_free_lists(pgdat, zone, zone->spanned_pages);

return 0;
}

/*
Expand All @@ -2077,6 +2080,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat,
unsigned long j;
int nid = pgdat->node_id;
unsigned long zone_start_pfn = pgdat->node_start_pfn;
int ret;

pgdat_resize_init(pgdat);
pgdat->nr_zones = 0;
Expand Down Expand Up @@ -2118,7 +2122,8 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat,
continue;

zonetable_add(zone, nid, j, zone_start_pfn, size);
init_currently_empty_zone(zone, zone_start_pfn, size);
ret = init_currently_empty_zone(zone, zone_start_pfn, size);
BUG_ON(ret);
zone_start_pfn += size;
}
}
Expand Down

0 comments on commit 73fc2c4

Please sign in to comment.