Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105326
b: refs/heads/master
c: df049a5
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Weiner authored and Linus Torvalds committed Jul 24, 2008
1 parent 8ed15a3 commit 562d0fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 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: 2e5237daf0cc3c8d87762f53f704dc54fa91dcf6
refs/heads/master: df049a5f41a3b2eee2131221959e3b558ba7c705
27 changes: 9 additions & 18 deletions trunk/mm/bootmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,11 @@ early_param("bootmem_debug", bootmem_debug_setup);
__FUNCTION__, ## args); \
})

/*
* Given an initialised bdata, it returns the size of the boot bitmap
*/
static unsigned long __init get_mapsize(bootmem_data_t *bdata)
static unsigned long __init bootmap_bytes(unsigned long pages)
{
unsigned long mapsize;
unsigned long start = PFN_DOWN(bdata->node_boot_start);
unsigned long end = bdata->node_low_pfn;
unsigned long bytes = (pages + 7) / 8;

mapsize = ((end - start) + 7) / 8;
return ALIGN(mapsize, sizeof(long));
return ALIGN(bytes, sizeof(long));
}

/**
Expand All @@ -69,13 +63,9 @@ static unsigned long __init get_mapsize(bootmem_data_t *bdata)
*/
unsigned long __init bootmem_bootmap_pages(unsigned long pages)
{
unsigned long mapsize;

mapsize = (pages+7)/8;
mapsize = (mapsize + ~PAGE_MASK) & PAGE_MASK;
mapsize >>= PAGE_SHIFT;
unsigned long bytes = bootmap_bytes(pages);

return mapsize;
return PAGE_ALIGN(bytes) >> PAGE_SHIFT;
}

/*
Expand Down Expand Up @@ -117,7 +107,7 @@ static unsigned long __init init_bootmem_core(bootmem_data_t *bdata,
* Initially all pages are reserved - setup_arch() has to
* register free RAM areas explicitly.
*/
mapsize = get_mapsize(bdata);
mapsize = bootmap_bytes(end - start);
memset(bdata->node_bootmem_map, 0xff, mapsize);

bdebug("nid=%td start=%lx map=%lx end=%lx mapsize=%lx\n",
Expand Down Expand Up @@ -160,7 +150,7 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
struct page *page;
unsigned long pfn;
unsigned long i, count;
unsigned long idx;
unsigned long idx, pages;
unsigned long *map;
int gofast = 0;

Expand Down Expand Up @@ -211,7 +201,8 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
* needed anymore:
*/
page = virt_to_page(bdata->node_bootmem_map);
idx = (get_mapsize(bdata) + PAGE_SIZE-1) >> PAGE_SHIFT;
pages = bdata->node_low_pfn - PFN_DOWN(bdata->node_boot_start);
idx = bootmem_bootmap_pages(pages);
for (i = 0; i < idx; i++, page++)
__free_pages_bootmem(page, 0);
count += i;
Expand Down

0 comments on commit 562d0fc

Please sign in to comment.