Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 196628
b: refs/heads/master
c: 91eea67
h: refs/heads/master
v: v3
  • Loading branch information
Mark Nelson authored and Benjamin Herrenschmidt committed May 6, 2010
1 parent f9f2b5a commit e9502be
Show file tree
Hide file tree
Showing 3 changed files with 50 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: 13bb5339966d49942878a46b0a7fda0639d7db5f
refs/heads/master: 91eea67c6d8704396a98226508c56a8501e141e3
6 changes: 6 additions & 0 deletions trunk/arch/powerpc/include/asm/pgalloc-64.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
#include <linux/cpumask.h>
#include <linux/percpu.h>

struct vmemmap_backing {
struct vmemmap_backing *list;
unsigned long phys;
unsigned long virt_addr;
};

/*
* Functions that deal with pagetables that could be at any level of
* the table need to be passed an "index_size" so they know how to
Expand Down
43 changes: 43 additions & 0 deletions trunk/arch/powerpc/mm/init_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,47 @@ static void __meminit vmemmap_create_mapping(unsigned long start,
}
#endif /* CONFIG_PPC_BOOK3E */

struct vmemmap_backing *vmemmap_list;

static __meminit struct vmemmap_backing * vmemmap_list_alloc(int node)
{
static struct vmemmap_backing *next;
static int num_left;

/* allocate a page when required and hand out chunks */
if (!next || !num_left) {
next = vmemmap_alloc_block(PAGE_SIZE, node);
if (unlikely(!next)) {
WARN_ON(1);
return NULL;
}
num_left = PAGE_SIZE / sizeof(struct vmemmap_backing);
}

num_left--;

return next++;
}

static __meminit void vmemmap_list_populate(unsigned long phys,
unsigned long start,
int node)
{
struct vmemmap_backing *vmem_back;

vmem_back = vmemmap_list_alloc(node);
if (unlikely(!vmem_back)) {
WARN_ON(1);
return;
}

vmem_back->phys = phys;
vmem_back->virt_addr = start;
vmem_back->list = vmemmap_list;

vmemmap_list = vmem_back;
}

int __meminit vmemmap_populate(struct page *start_page,
unsigned long nr_pages, int node)
{
Expand All @@ -276,6 +317,8 @@ int __meminit vmemmap_populate(struct page *start_page,
if (!p)
return -ENOMEM;

vmemmap_list_populate(__pa(p), start, node);

pr_debug(" * %016lx..%016lx allocated at %p\n",
start, start + page_size, p);

Expand Down

0 comments on commit e9502be

Please sign in to comment.