From b8cf3cb879a19c001796329ebe266104d13e63be Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sat, 7 Feb 2015 02:52:23 +0100 Subject: kernel: reduce Page structure size by changing Page.cachectl[] there are no kernels currently that do page coloring, so the only use of cachectl[] is flushing the icache (on arm and ppc). on pc64, cachectl consumes 32 bytes in each page resulting in over 200 megabytes of overhead for 32gb of ram with 4K pages. this change removes cachectl[] and adds txtflush ulong that is set to ~0 by pio() to instruct putmmu() to flush the icache. --- sys/src/9/ppc/main.c | 2 +- sys/src/9/ppc/mmu.c | 15 ++------------- 2 files changed, 3 insertions(+), 14 deletions(-) (limited to 'sys/src/9/ppc') diff --git a/sys/src/9/ppc/main.c b/sys/src/9/ppc/main.c index a77f31127..e0badeb57 100644 --- a/sys/src/9/ppc/main.c +++ b/sys/src/9/ppc/main.c @@ -233,7 +233,7 @@ userinit(void) s->flushme++; p->seg[TSEG] = s; pg = newpage(1, 0, UTZERO); - memset(pg->cachectl, PG_TXTFLUSH, sizeof(pg->cachectl)); + pg->txtflush = ~0; segpage(s, pg); k = kmap(s->map[0]->pages[0]); memmove((ulong*)VA(k), initcode, sizeof initcode); diff --git a/sys/src/9/ppc/mmu.c b/sys/src/9/ppc/mmu.c index 94dbeb03c..a47bf2d56 100644 --- a/sys/src/9/ppc/mmu.c +++ b/sys/src/9/ppc/mmu.c @@ -199,7 +199,6 @@ void putmmu(uintptr va, uintptr pa, Page *pg) { int mp; - char *ctl; ulong *p, *ep, *q, pteg; ulong vsid, hash; ulong ptehi, x; @@ -244,21 +243,11 @@ putmmu(uintptr va, uintptr pa, Page *pg) q[0] = ptehi; q[1] = pa; - ctl = &pg->cachectl[m->machno]; - switch(*ctl) { - case PG_NEWCOL: - default: - panic("putmmu: %d\n", *ctl); - break; - case PG_TXTFLUSH: + if(pg->txtflush & (1<machno)){ dcflush((void*)pg->va, BY2PG); icflush((void*)pg->va, BY2PG); - *ctl = PG_NOFLUSH; - break; - case PG_NOFLUSH: - break; + pg->txtflush &= ~(1<machno); } - } void -- cgit v1.2.3