diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-05-01 12:40:27 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-05-01 12:40:27 +0200 |
commit | fe594760ebddac23e673d189d2152062ef75d8b8 (patch) | |
tree | 7dbf1a9c636c943c477787841eaa4d85d1cff78b | |
parent | b452f8857f22089adca137f32b9456a208554800 (diff) | |
download | plan9front-fe594760ebddac23e673d189d2152062ef75d8b8.tar.xz |
kernel: get rid of checkpagerefs() debugging
was only implemented by the pc kernel. does not
account pages used by the mount cache.
-rw-r--r-- | sys/src/9/mtx/mmu.c | 5 | ||||
-rw-r--r-- | sys/src/9/pc64/mmu.c | 6 | ||||
-rw-r--r-- | sys/src/9/port/page.c | 116 | ||||
-rw-r--r-- | sys/src/9/port/portfns.h | 1 | ||||
-rw-r--r-- | sys/src/9/port/sysproc.c | 4 | ||||
-rw-r--r-- | sys/src/9/ppc/mmu.c | 5 | ||||
-rw-r--r-- | sys/src/9/sgi/mmu.c | 5 | ||||
-rw-r--r-- | sys/src/9/xen/mmu.c | 10 | ||||
-rw-r--r-- | sys/src/9/zynq/mmu.c | 6 |
9 files changed, 0 insertions, 158 deletions
diff --git a/sys/src/9/mtx/mmu.c b/sys/src/9/mtx/mmu.c index 791c968da..c4030ce8f 100644 --- a/sys/src/9/mtx/mmu.c +++ b/sys/src/9/mtx/mmu.c @@ -229,11 +229,6 @@ checkmmu(uintptr, uintptr) { } -void -countpagerefs(ulong*, int) -{ -} - /* * Return the number of bytes that can be accessed via KADDR(pa). * If pa is not a valid argument to KADDR, return 0. diff --git a/sys/src/9/pc64/mmu.c b/sys/src/9/pc64/mmu.c index 45bc76d40..9261354e8 100644 --- a/sys/src/9/pc64/mmu.c +++ b/sys/src/9/pc64/mmu.c @@ -468,12 +468,6 @@ cankaddr(uintptr pa) return -KZERO - pa; } -void -countpagerefs(ulong *ref, int print) -{ - USED(ref, print); -} - KMap* kmap(Page *page) { diff --git a/sys/src/9/port/page.c b/sys/src/9/port/page.c index 6e74cbe4e..582ebb786 100644 --- a/sys/src/9/port/page.c +++ b/sys/src/9/port/page.c @@ -399,119 +399,3 @@ freepte(Segment *s, Pte *p) } free(p); } - -ulong -pagenumber(Page *p) -{ - return p-palloc.pages; -} - -void -checkpagerefs(void) -{ - int s; - ulong i, np, nwrong; - ulong *ref; - - np = palloc.user; - ref = malloc(np*sizeof ref[0]); - if(ref == nil){ - print("checkpagerefs: out of memory\n"); - return; - } - - /* - * This may not be exact if there are other processes - * holding refs to pages on their stacks. The hope is - * that if you run it on a quiescent system it will still - * be useful. - */ - s = splhi(); - lock(&palloc); - countpagerefs(ref, 0); - portcountpagerefs(ref, 0); - nwrong = 0; - for(i=0; i<np; i++){ - if(palloc.pages[i].ref != ref[i]){ - iprint("page %#p ref %ld actual %lud\n", - palloc.pages[i].pa, palloc.pages[i].ref, ref[i]); - ref[i] = 1; - nwrong++; - }else - ref[i] = 0; - } - countpagerefs(ref, 1); - portcountpagerefs(ref, 1); - iprint("%lud mistakes found\n", nwrong); - unlock(&palloc); - splx(s); - free(ref); -} - -void -portcountpagerefs(ulong *ref, int print) -{ - ulong i, j, k, ns, n; - Page **pg, *entry; - Proc *p; - Pte *pte; - Segment *s; - - /* - * Pages in segments. s->mark avoids double-counting. - */ - n = 0; - ns = 0; - for(i=0; i<conf.nproc; i++){ - p = proctab(i); - for(j=0; j<NSEG; j++){ - s = p->seg[j]; - if(s != nil) - s->mark = 0; - } - } - for(i=0; i<conf.nproc; i++){ - p = proctab(i); - for(j=0; j<NSEG; j++){ - s = p->seg[j]; - if(s == nil || s->mark++) - continue; - if((s->type&SG_TYPE) == SG_PHYSICAL) - continue; - ns++; - for(k=0; k<s->mapsize; k++){ - pte = s->map[k]; - if(pte == nil) - continue; - for(pg = pte->first; pg <= pte->last; pg++){ - entry = *pg; - if(pagedout(entry)) - continue; - if(print){ - if(ref[pagenumber(entry)]) - iprint("page %#p in segment %#p\n", entry->pa, s); - continue; - } - if(ref[pagenumber(entry)]++ == 0) - n++; - } - } - } - } - if(!print){ - iprint("%lud pages in %lud segments\n", n, ns); - for(i=0; i<conf.nproc; i++){ - p = proctab(i); - for(j=0; j<NSEG; j++){ - s = p->seg[j]; - if(s == nil) - continue; - if(s->ref != s->mark){ - iprint("segment %#p (used by proc %lud pid %lud) has bad ref count %lud actual %lud\n", - s, i, p->pid, s->ref, s->mark); - } - } - } - } -} - diff --git a/sys/src/9/port/portfns.h b/sys/src/9/port/portfns.h index 6d41cd03a..c92706888 100644 --- a/sys/src/9/port/portfns.h +++ b/sys/src/9/port/portfns.h @@ -207,7 +207,6 @@ Block* padblock(Block*, int); void pagechaindone(void); void pagechainhead(Page*); void pageinit(void); -ulong pagenumber(Page*); ulong pagereclaim(Image*, ulong); void panic(char*, ...); Cmdbuf* parsecmd(char *a, int n); diff --git a/sys/src/9/port/sysproc.c b/sys/src/9/port/sysproc.c index 5a20316f1..705dbf415 100644 --- a/sys/src/9/port/sysproc.c +++ b/sys/src/9/port/sysproc.c @@ -9,15 +9,11 @@ #include <a.out.h> -extern void checkpages(void); -extern void checkpagerefs(void); - uintptr sysr1(va_list) { if(!iseve()) error(Eperm); - checkpagerefs(); return 0; } diff --git a/sys/src/9/ppc/mmu.c b/sys/src/9/ppc/mmu.c index a47bf2d56..88ef49e2d 100644 --- a/sys/src/9/ppc/mmu.c +++ b/sys/src/9/ppc/mmu.c @@ -255,11 +255,6 @@ checkmmu(uintptr, uintptr) { } -void -countpagerefs(ulong*, int) -{ -} - /* * Return the number of bytes that can be accessed via KADDR(pa). * If pa is not a valid argument to KADDR, return 0. diff --git a/sys/src/9/sgi/mmu.c b/sys/src/9/sgi/mmu.c index 8af2956e2..3d7e9f569 100644 --- a/sys/src/9/sgi/mmu.c +++ b/sys/src/9/sgi/mmu.c @@ -461,11 +461,6 @@ checkmmu(ulong, ulong) { } -void -countpagerefs(ulong*, int) -{ -} - /* * Return the number of bytes that can be accessed via KADDR(pa). * If pa is not a valid argument to KADDR, return 0. diff --git a/sys/src/9/xen/mmu.c b/sys/src/9/xen/mmu.c index c293fdaeb..1a5c3d067 100644 --- a/sys/src/9/xen/mmu.c +++ b/sys/src/9/xen/mmu.c @@ -509,16 +509,6 @@ mmukmapsync(ulong va) } /* - * More debugging. - */ -void -countpagerefs(ulong *ref, int print) -{ - USED(ref); - USED(print); -} - -/* * Return the number of bytes that can be accessed via KADDR(pa). * If pa is not a valid argument to KADDR, return 0. */ diff --git a/sys/src/9/zynq/mmu.c b/sys/src/9/zynq/mmu.c index e3e63bd3d..918f930b5 100644 --- a/sys/src/9/zynq/mmu.c +++ b/sys/src/9/zynq/mmu.c @@ -242,12 +242,6 @@ mmurelease(Proc *proc) proc->mmufree = nil; } -void -countpagerefs(ulong *, int) -{ - print("countpagerefs\n"); -} - uintptr paddr(void *v) { |