summaryrefslogtreecommitdiff
path: root/sys/src/9/port/page.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-06-01 03:13:58 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2014-06-01 03:13:58 +0200
commitc9f91d50154015ef31b6e63131847742893ffc91 (patch)
tree8a94dce9adbe9ca224c6112d9080296ef57ba7e6 /sys/src/9/port/page.c
parent8061f30e559569943324a666ee2fcc74048785cd (diff)
pc64: allocate palloc.pages from upages
the palloc.pages array takes arround 5% of the upages which gives us: 16GB = ~0.8GB 32GB = ~1.6GB 64GB = ~3.2GB we only have 2GB of address space above KZERO so this will not work for long. instead, pageinit() was altered to accept a preallocated memory in palloc.pages. and preallocpages() in pc64/main.c allocates the in upages memory, mapping it in the VMAP area (which has 512GB). the drawback is that we cannot poke at Page structures now from /proc/n/mem as the VMAP area is not accessible from it.
Diffstat (limited to 'sys/src/9/port/page.c')
-rw-r--r--sys/src/9/port/page.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/sys/src/9/port/page.c b/sys/src/9/port/page.c
index 96b7b9ab7..48e393d2b 100644
--- a/sys/src/9/port/page.c
+++ b/sys/src/9/port/page.c
@@ -16,16 +16,19 @@ pageinit(void)
Page *p;
Pallocmem *pm;
vlong m, v, u;
- ulong np;
- np = 0;
- for(i=0; i<nelem(palloc.mem); i++){
- pm = &palloc.mem[i];
- np += pm->npage;
+ if(palloc.pages == nil){
+ ulong np;
+
+ np = 0;
+ for(i=0; i<nelem(palloc.mem); i++){
+ pm = &palloc.mem[i];
+ np += pm->npage;
+ }
+ palloc.pages = xalloc(np*sizeof(Page));
+ if(palloc.pages == nil)
+ panic("pageinit");
}
- palloc.pages = xalloc(np*sizeof(Page));
- if(palloc.pages == 0)
- panic("pageinit");
color = 0;
palloc.head = palloc.pages;
@@ -33,6 +36,7 @@ pageinit(void)
for(i=0; i<nelem(palloc.mem); i++){
pm = &palloc.mem[i];
for(j=0; j<pm->npage; j++){
+ memset(p, 0, sizeof *p);
p->prev = p-1;
p->next = p+1;
p->pa = pm->base+j*BY2PG;