Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Jun 1996 22:00:31 -0500 (EST)
From:      "John S. Dyson" <toor@dyson.iquest.net>
To:        fcurrent@jraynard.demon.co.uk (James Raynard)
Cc:        plm@xs4all.nl, freebsd-current@FreeBSD.org
Subject:   Re: More on VM, swap leaks
Message-ID:  <199606070300.WAA01131@dyson.iquest.net>
In-Reply-To: <199606070203.CAA02611@jraynard.demon.co.uk> from "James Raynard" at Jun 7, 96 02:03:44 am

next in thread | previous in thread | raw e-mail | index | archive | help
> 
>  
> >     JH> Another possibility is a bad emacs binary.  Especially since
> >     JH> as part of the compilation process, emacs runs itself, loads
> >     JH> in a bunch of LISP, then pukes itself out as a new executable.
> >     JH> I shudder to think what could happen if a buggy kernel or bad
> >     JH> SIMM decided to rear its head at that point.
> > 
> > I have the same problems.
> 
> I have had other programs die, as well Emacs:-
> 
> Jun 4 16:05:00 jraynard /kernel: pid 10265 (atrun), uid 0: exited on signal 10 
> Jun 6 23:16:05 jraynard /kernel: pid 148 (innd), uid 8: exited on signal 10
> 
No guarantees, but I found a *major* omission in pmap.c.  Replace the
pmap_object_init_pt routine in pmap.c with the following, and see how
things go:


void
pmap_object_init_pt(pmap, addr, object, pindex, size, limit)
	pmap_t pmap;
	vm_offset_t addr;
	vm_object_t object;
	vm_pindex_t pindex;
	vm_size_t size;
	int limit;
{
	vm_offset_t tmpidx;
	int psize;
	vm_page_t p;
	int objpgs;

	psize = (size >> PAGE_SHIFT);

	if (!pmap || (object->type != OBJT_VNODE) ||
		(limit && (psize > MAX_INIT_PT) &&
			(object->resident_page_count > MAX_INIT_PT))) {
		return;
	}

	/*
	 * if we are processing a major portion of the object, then scan the
	 * entire thing.
	 */
	if (psize > (object->size >> 2)) {
		objpgs = psize;

		for (p = TAILQ_FIRST(&object->memq);
		    ((objpgs > 0) && (p != NULL));
		    p = TAILQ_NEXT(p, listq)) {

			tmpidx = p->pindex;
			if (tmpidx < pindex) {
				continue;
			}
			tmpidx -= pindex;
			if (tmpidx >= psize) {
				continue;
			}
			if (((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
			    (p->busy == 0) &&
			    (p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
				if (p->queue == PQ_CACHE)
					vm_page_deactivate(p);
				p->flags |= PG_BUSY;
				pmap_enter_quick(pmap, 
					addr + (tmpidx << PAGE_SHIFT),
					VM_PAGE_TO_PHYS(p));
				p->flags |= PG_MAPPED;
				PAGE_WAKEUP(p);
			}
			objpgs -= 1;
		}
	} else {
		/*
		 * else lookup the pages one-by-one.
		 */
		for (tmpidx = 0; tmpidx < psize; tmpidx += 1) {
			p = vm_page_lookup(object, tmpidx + pindex);
			if (p &&
			    ((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
			    (p->busy == 0) &&
			    (p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
				if (p->queue == PQ_CACHE)
					vm_page_deactivate(p);
				p->flags |= PG_BUSY;
				pmap_enter_quick(pmap, 
					addr + (tmpidx << PAGE_SHIFT),
					VM_PAGE_TO_PHYS(p));
				p->flags |= PG_MAPPED;
				PAGE_WAKEUP(p);
			}
		}
	}
	return;
}




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606070300.WAA01131>